1f58cce03SPrashanth Katti*** Settings ***
2f58cce03SPrashanth KattiDocumentation  Network interface configuration and verification
3f58cce03SPrashanth Katti               ...  tests.
4f58cce03SPrashanth Katti
5f58cce03SPrashanth KattiResource       ../../lib/bmc_redfish_resource.robot
6f58cce03SPrashanth KattiResource       ../../lib/bmc_network_utils.robot
7f58cce03SPrashanth KattiResource       ../../lib/openbmc_ffdc.robot
8747ce9d0SPrashanth KattiLibrary        ../../lib/bmc_network_utils.py
9de3bf7b5SVijayLibrary        Collections
10f58cce03SPrashanth Katti
11ca054eeeSaravinth0510Suite Setup     Suite Setup Execution
12ca054eeeSaravinth0510Suite Teardown  Suite Teardown Execution
13f58cce03SPrashanth KattiTest Setup      Test Setup Execution
14f58cce03SPrashanth KattiTest Teardown   Test Teardown Execution
15f58cce03SPrashanth Katti
169899a909SGeorge KeishingForce Tags     Bmc_Network_Conf
17f34fafabSPrashanth Katti
1823efc6e3SPrashanth Katti*** Variables ***
1923efc6e3SPrashanth Katti${test_hostname}           openbmc
20de3bf7b5SVijay${test_ipv4_addr}          10.7.7.7
21de3bf7b5SVijay${test_ipv4_invalid_addr}  0.0.1.a
22de3bf7b5SVijay${test_subnet_mask}        255.255.0.0
23b36a7521SPrashanth Katti${broadcast_ip}            10.7.7.255
24b36a7521SPrashanth Katti${loopback_ip}             127.0.0.2
25b36a7521SPrashanth Katti${multicast_ip}            224.6.6.6
26b36a7521SPrashanth Katti${out_of_range_ip}         10.7.7.256
27568df5f1SPrashanth Katti${test_ipv4_addr2}         10.7.7.8
2823efc6e3SPrashanth Katti
2916b3c7bfSGeorge Keishing# Valid netmask is 4 bytes long and has continuous block of 1s.
30040c8c12SPrashanth Katti# Maximum valid value in each octet is 255 and least value is 0.
31040c8c12SPrashanth Katti# 253 is not valid, as binary value is 11111101.
32040c8c12SPrashanth Katti${invalid_netmask}         255.255.253.0
33040c8c12SPrashanth Katti${alpha_netmask}           ff.ff.ff.ff
34040c8c12SPrashanth Katti# Maximum value of octet in netmask is 255.
35040c8c12SPrashanth Katti${out_of_range_netmask}    255.256.255.0
36040c8c12SPrashanth Katti${more_byte_netmask}       255.255.255.0.0
37040c8c12SPrashanth Katti${less_byte_netmask}       255.255.255
38c6ad647fSPrashanth Katti${threshold_netmask}       255.255.255.255
39c6ad647fSPrashanth Katti${lowest_netmask}          128.0.0.0
40c6ad647fSPrashanth Katti
41c6ad647fSPrashanth Katti# There will be 4 octets in IP address (e.g. xx.xx.xx.xx)
42c6ad647fSPrashanth Katti# but trying to configure xx.xx.xx
43c6ad647fSPrashanth Katti${less_octet_ip}           10.3.36
44c6ad647fSPrashanth Katti
45c6ad647fSPrashanth Katti# For the address 10.6.6.6, the 10.6.6.0 portion describes the
46c6ad647fSPrashanth Katti# network ID and the 6 describe the host.
47c6ad647fSPrashanth Katti
48c6ad647fSPrashanth Katti${network_id}              10.7.7.0
49c6ad647fSPrashanth Katti${hex_ip}                  0xa.0xb.0xc.0xd
50c6ad647fSPrashanth Katti${negative_ip}             10.-7.-7.7
517098c976SPrashanth Katti@{static_name_servers}     10.5.5.5
523c7b6439SPrashanth Katti@{null_value}              null
53afe16b72SPrashanth Katti@{empty_dictionary}        {}
54afe16b72SPrashanth Katti@{string_value}            aa.bb.cc.dd
55afe16b72SPrashanth Katti
56f58cce03SPrashanth Katti*** Test Cases ***
57f58cce03SPrashanth Katti
58f58cce03SPrashanth KattiGet IP Address And Verify
59f58cce03SPrashanth Katti    [Documentation]  Get IP Address And Verify.
60f58cce03SPrashanth Katti    [Tags]  Get_IP_Address_And_Verify
61f58cce03SPrashanth Katti
6250621144SSushil Singh    FOR  ${network_configuration}  IN  @{network_configurations}
6350621144SSushil Singh      Verify IP On BMC  ${network_configuration['Address']}
6450621144SSushil Singh    END
65747ce9d0SPrashanth Katti
66f58cce03SPrashanth KattiGet Netmask And Verify
67f58cce03SPrashanth Katti    [Documentation]  Get Netmask And Verify.
68f58cce03SPrashanth Katti    [Tags]  Get_Netmask_And_Verify
69f58cce03SPrashanth Katti
7050621144SSushil Singh    FOR  ${network_configuration}  IN  @{network_configurations}
7150621144SSushil Singh      Verify Netmask On BMC  ${network_configuration['SubnetMask']}
7250621144SSushil Singh    END
73747ce9d0SPrashanth Katti
742ec9d8b6SPrashanth KattiGet Gateway And Verify
752ec9d8b6SPrashanth Katti    [Documentation]  Get gateway and verify it's existence on the BMC.
762ec9d8b6SPrashanth Katti    [Tags]  Get_Gateway_And_Verify
772ec9d8b6SPrashanth Katti
7850621144SSushil Singh    FOR  ${network_configuration}  IN  @{network_configurations}
7950621144SSushil Singh      Verify Gateway On BMC  ${network_configuration['Gateway']}
8050621144SSushil Singh    END
812ec9d8b6SPrashanth Katti
822ec9d8b6SPrashanth KattiGet MAC Address And Verify
832ec9d8b6SPrashanth Katti    [Documentation]  Get MAC address and verify it's existence on the BMC.
842ec9d8b6SPrashanth Katti    [Tags]  Get_MAC_Address_And_Verify
852ec9d8b6SPrashanth Katti
86412c6680STony Lee    ${active_channel_config}=  Get Active Channel Config
87412c6680STony Lee    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
88412c6680STony Lee
89412c6680STony Lee    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
902ec9d8b6SPrashanth Katti    ${macaddr}=  Get From Dictionary  ${resp.dict}  MACAddress
912ec9d8b6SPrashanth Katti    Validate MAC On BMC  ${macaddr}
92f58cce03SPrashanth Katti
932c5c3bbdSPrashanth KattiVerify All Configured IP And Netmask
942c5c3bbdSPrashanth Katti    [Documentation]  Verify all configured IP and netmask on BMC.
952c5c3bbdSPrashanth Katti    [Tags]  Verify_All_Configured_IP_And_Netmask
962c5c3bbdSPrashanth Katti
9750621144SSushil Singh    FOR  ${network_configuration}  IN  @{network_configurations}
9850621144SSushil Singh      Verify IP And Netmask On BMC  ${network_configuration['Address']}
992c5c3bbdSPrashanth Katti      ...  ${network_configuration['SubnetMask']}
10050621144SSushil Singh    END
1012c5c3bbdSPrashanth Katti
10223efc6e3SPrashanth KattiGet Hostname And Verify
10323efc6e3SPrashanth Katti    [Documentation]  Get hostname via Redfish and verify.
10423efc6e3SPrashanth Katti    [Tags]  Get_Hostname_And_Verify
10523efc6e3SPrashanth Katti
10623efc6e3SPrashanth Katti    ${hostname}=  Redfish_Utils.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName
10723efc6e3SPrashanth Katti
10823efc6e3SPrashanth Katti    Validate Hostname On BMC  ${hostname}
10923efc6e3SPrashanth Katti
11023efc6e3SPrashanth KattiConfigure Hostname And Verify
11123efc6e3SPrashanth Katti    [Documentation]  Configure hostname via Redfish and verify.
11223efc6e3SPrashanth Katti    [Tags]  Configure_Hostname_And_Verify
113578276cbSshrsuman123    [Teardown]  Run Keywords
114578276cbSshrsuman123    ...  Configure Hostname  ${hostname}  AND  Validate Hostname On BMC  ${hostname}
11523efc6e3SPrashanth Katti
116adf0b4e7SPrashanth Katti    ${hostname}=  Redfish_Utils.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName
11723efc6e3SPrashanth Katti
118adf0b4e7SPrashanth Katti    Configure Hostname  ${test_hostname}
11923efc6e3SPrashanth Katti    Validate Hostname On BMC  ${test_hostname}
12023efc6e3SPrashanth Katti
121*645128a6SSweta Potthuri    # Verify configured hostname via Redfish.
12260784a43Snagarjunb22    ${new_hostname}=  Redfish_Utils.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName
12360784a43Snagarjunb22    Should Be Equal  ${new_hostname}  ${test_hostname}
12460784a43Snagarjunb22
125cff1021eSAnvesh-Kumar_RayankulaConfigure Invalid HostName And Verify
126*645128a6SSweta Potthuri    [Documentation]  Configure invalid hostname via Redfish and verify.
127cff1021eSAnvesh-Kumar_Rayankula    [Tags]  Configure_Invalid_HostName_And_Verify
128cff1021eSAnvesh-Kumar_Rayankula    [Template]  Configure Hostname
129cff1021eSAnvesh-Kumar_Rayankula
130cff1021eSAnvesh-Kumar_Rayankula    # hostname          status_code
131cff1021eSAnvesh-Kumar_Rayankula    !#@                 [${HTTP_BAD_REQUEST}]
132*645128a6SSweta Potthuri
133*645128a6SSweta PotthuriConfigure Empty HostName And Verify If LocalHost Is Assigned
134*645128a6SSweta Potthuri    [Documentation]  Configure empty hostname and verify if localHost is assigned.
135*645128a6SSweta Potthuri    [Tags]  Configure_Empty_HostName_And_Verify_If_LocalHost_Is_Assigned
136*645128a6SSweta Potthuri    [Teardown]  Run Keywords
137*645128a6SSweta Potthuri    ...  Configure Hostname  ${hostname}  AND  Validate Hostname On BMC  ${hostname}
138*645128a6SSweta Potthuri
139*645128a6SSweta Potthuri    ${hostname}=  Redfish_Utils.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName
140*645128a6SSweta Potthuri
141*645128a6SSweta Potthuri    Configure Hostname  ${EMPTY}
142*645128a6SSweta Potthuri    Validate Hostname On BMC  localhost
143*645128a6SSweta Potthuri
144*645128a6SSweta Potthuri    # Verify configured hostname via Redfish.
145*645128a6SSweta Potthuri    ${new_hostname}=  Redfish_Utils.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName
146*645128a6SSweta Potthuri    Should Be Equal  ${new_hostname}  localhost
147adf0b4e7SPrashanth Katti
148de3bf7b5SVijayAdd Valid IPv4 Address And Verify
149de3bf7b5SVijay    [Documentation]  Add IPv4 Address via Redfish and verify.
1500c8100ffSGeorge Keishing    [Tags]  Add_Valid_IPv4_Address_And_Verify
1519c7238daSAnvesh Kumar    [Teardown]   Run Keywords
1529c7238daSAnvesh Kumar    ...  Delete IP Address  ${test_ipv4_addr}  AND  Test Teardown Execution
153de3bf7b5SVijay
154de3bf7b5SVijay     Add IP Address  ${test_ipv4_addr}  ${test_subnet_mask}  ${test_gateway}
155de3bf7b5SVijay
156de3bf7b5SVijayAdd Invalid IPv4 Address And Verify
157de3bf7b5SVijay    [Documentation]  Add Invalid IPv4 Address via Redfish and verify.
1580c8100ffSGeorge Keishing    [Tags]  Add_Invalid_IPv4_Address_And_Verify
159de3bf7b5SVijay
160de3bf7b5SVijay    Add IP Address  ${test_ipv4_invalid_addr}  ${test_subnet_mask}
161de3bf7b5SVijay    ...  ${test_gateway}  valid_status_codes=${HTTP_BAD_REQUEST}
162de3bf7b5SVijay
163b36a7521SPrashanth KattiConfigure Out Of Range IP
164b36a7521SPrashanth Katti    [Documentation]  Configure out-of-range IP address.
165b36a7521SPrashanth Katti    [Tags]  Configure_Out_Of_Range_IP
166b36a7521SPrashanth Katti    [Template]  Add IP Address
167b36a7521SPrashanth Katti
168b36a7521SPrashanth Katti    # ip                subnet_mask          gateway          valid_status_codes
169b36a7521SPrashanth Katti    ${out_of_range_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
170b36a7521SPrashanth Katti
171b36a7521SPrashanth KattiConfigure Broadcast IP
172b36a7521SPrashanth Katti    [Documentation]  Configure broadcast IP address.
173b36a7521SPrashanth Katti    [Tags]  Configure_Broadcast_IP
174b36a7521SPrashanth Katti    [Template]  Add IP Address
175c6ad647fSPrashanth Katti    [Teardown]  Clear IP Settings On Fail  ${broadcast_ip}
176b36a7521SPrashanth Katti
177b36a7521SPrashanth Katti    # ip             subnet_mask          gateway          valid_status_codes
178b36a7521SPrashanth Katti    ${broadcast_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
179b36a7521SPrashanth Katti
180b36a7521SPrashanth KattiConfigure Multicast IP
181b36a7521SPrashanth Katti    [Documentation]  Configure multicast IP address.
182b36a7521SPrashanth Katti    [Tags]  Configure_Multicast_IP
183b36a7521SPrashanth Katti    [Template]  Add IP Address
184c6ad647fSPrashanth Katti    [Teardown]  Clear IP Settings On Fail  ${multicast_ip}
185b36a7521SPrashanth Katti
186b36a7521SPrashanth Katti    # ip             subnet_mask          gateway          valid_status_codes
187b36a7521SPrashanth Katti    ${multicast_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
188b36a7521SPrashanth Katti
189b36a7521SPrashanth KattiConfigure Loopback IP
190b36a7521SPrashanth Katti    [Documentation]  Configure loopback IP address.
191b36a7521SPrashanth Katti    [Tags]  Configure_Loopback_IP
192b36a7521SPrashanth Katti    [Template]  Add IP Address
193c6ad647fSPrashanth Katti    [Teardown]  Clear IP Settings On Fail  ${loopback_ip}
194b36a7521SPrashanth Katti
195b36a7521SPrashanth Katti    # ip            subnet_mask          gateway          valid_status_codes
196b36a7521SPrashanth Katti    ${loopback_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
197b36a7521SPrashanth Katti
198b36a7521SPrashanth KattiAdd Valid IPv4 Address And Check Persistency
19960784a43Snagarjunb22    [Documentation]  Add IPv4 address and check persistency.
2000c8100ffSGeorge Keishing    [Tags]  Add_Valid_IPv4_Address_And_Check_Persistency
20160784a43Snagarjunb22    [Teardown]  Run Keywords
20260784a43Snagarjunb22    ...  Delete IP Address  ${test_ipv4_addr}  AND  Test Teardown Execution
203b36a7521SPrashanth Katti
204b36a7521SPrashanth Katti    Add IP Address  ${test_ipv4_addr}  ${test_subnet_mask}  ${test_gateway}
205b36a7521SPrashanth Katti
206b36a7521SPrashanth Katti    # Reboot BMC and verify persistency.
20763f0b10cSSweta Potthuri    Redfish OBMC Reboot (off)  stack_mode=skip
2085c498748SGeorge Keishing    Redfish.Login
209b36a7521SPrashanth Katti    Verify IP On BMC  ${test_ipv4_addr}
21060784a43Snagarjunb22    Verify IP On Redfish URI  ${test_ipv4_addr}
21160784a43Snagarjunb22
212de3bf7b5SVijay
2136cedca29SPrashanth KattiAdd Fourth Octet Threshold IP And Verify
2146cedca29SPrashanth Katti    [Documentation]  Add fourth octet threshold IP and verify.
2156cedca29SPrashanth Katti    [Tags]  Add_Fourth_Octet_Threshold_IP_And_Verify
2169c7238daSAnvesh Kumar    [Teardown]  Run Keywords
2179c7238daSAnvesh Kumar    ...  Delete IP Address  10.7.7.254  AND  Test Teardown Execution
2186cedca29SPrashanth Katti
2196cedca29SPrashanth Katti     Add IP Address  10.7.7.254  ${test_subnet_mask}  ${test_gateway}
2206cedca29SPrashanth Katti
2216cedca29SPrashanth KattiAdd Fourth Octet Lowest IP And Verify
2226cedca29SPrashanth Katti    [Documentation]  Add fourth octet lowest IP and verify.
2236cedca29SPrashanth Katti    [Tags]  Add_Fourth_Octet_Lowest_IP_And_Verify
2249c7238daSAnvesh Kumar    [Teardown]  Run Keywords
2259c7238daSAnvesh Kumar    ...  Delete IP Address  10.7.7.1  AND  Test Teardown Execution
2266cedca29SPrashanth Katti
2276cedca29SPrashanth Katti     Add IP Address  10.7.7.1  ${test_subnet_mask}  ${test_gateway}
2286cedca29SPrashanth Katti
2296cedca29SPrashanth KattiAdd Third Octet Threshold IP And Verify
2306cedca29SPrashanth Katti    [Documentation]  Add third octet threshold IP and verify.
2316cedca29SPrashanth Katti    [Tags]  Add_Third_Octet_Threshold_IP_And_Verify
2329c7238daSAnvesh Kumar    [Teardown]  Run Keywords
2339c7238daSAnvesh Kumar    ...  Delete IP Address  10.7.255.7  AND  Test Teardown Execution
2346cedca29SPrashanth Katti
2356cedca29SPrashanth Katti     Add IP Address  10.7.255.7  ${test_subnet_mask}  ${test_gateway}
2366cedca29SPrashanth Katti
2376cedca29SPrashanth KattiAdd Third Octet Lowest IP And Verify
2386cedca29SPrashanth Katti    [Documentation]  Add third octet lowest IP and verify.
2396cedca29SPrashanth Katti    [Tags]  Add_Third_Octet_Lowest_IP_And_Verify
2409c7238daSAnvesh Kumar    [Teardown]  Run Keywords
2419c7238daSAnvesh Kumar    ...  Delete IP Address  10.7.0.7  AND  Test Teardown Execution
2426cedca29SPrashanth Katti
2436cedca29SPrashanth Katti     Add IP Address  10.7.0.7  ${test_subnet_mask}  ${test_gateway}
2446cedca29SPrashanth Katti
2456cedca29SPrashanth KattiAdd Second Octet Threshold IP And Verify
2466cedca29SPrashanth Katti    [Documentation]  Add second octet threshold IP and verify.
2476cedca29SPrashanth Katti    [Tags]  Add_Second_Octet_Threshold_IP_And_Verify
2489c7238daSAnvesh Kumar    [Teardown]  Run Keywords
2499c7238daSAnvesh Kumar    ...  Delete IP Address  10.255.7.7  AND  Test Teardown Execution
2506cedca29SPrashanth Katti
2516cedca29SPrashanth Katti     Add IP Address  10.255.7.7  ${test_subnet_mask}  ${test_gateway}
2526cedca29SPrashanth Katti
2536cedca29SPrashanth KattiAdd Second Octet Lowest IP And Verify
2546cedca29SPrashanth Katti    [Documentation]  Add second octet lowest IP and verify.
2556cedca29SPrashanth Katti    [Tags]  Add_Second_Octet_Lowest_IP_And_Verify
2569c7238daSAnvesh Kumar    [Teardown]  Run Keywords
2579c7238daSAnvesh Kumar    ...  Delete IP Address  10.0.7.7  AND  Test Teardown Execution
2586cedca29SPrashanth Katti
2596cedca29SPrashanth Katti     Add IP Address  10.0.7.7  ${test_subnet_mask}  ${test_gateway}
2606cedca29SPrashanth Katti
2616cedca29SPrashanth KattiAdd First Octet Threshold IP And Verify
2626cedca29SPrashanth Katti    [Documentation]  Add first octet threshold IP and verify.
2636cedca29SPrashanth Katti    [Tags]  Add_First_Octet_Threshold_IP_And_Verify
2649c7238daSAnvesh Kumar    [Teardown]  Run Keywords
265f757b107SAnves Kumar rayankula    ...  Delete IP Address  223.7.7.7  AND  Test Teardown Execution
2666cedca29SPrashanth Katti
2676cedca29SPrashanth Katti     Add IP Address  223.7.7.7  ${test_subnet_mask}  ${test_gateway}
2686cedca29SPrashanth Katti
2696cedca29SPrashanth KattiAdd First Octet Lowest IP And Verify
2706cedca29SPrashanth Katti    [Documentation]  Add first octet lowest IP and verify.
2716cedca29SPrashanth Katti    [Tags]  Add_First_Octet_Lowest_IP_And_Verify
2729c7238daSAnvesh Kumar    [Teardown]  Run Keywords
2739c7238daSAnvesh Kumar    ...  Delete IP Address  1.7.7.7  AND  Test Teardown Execution
2746cedca29SPrashanth Katti
2756cedca29SPrashanth Katti     Add IP Address  1.7.7.7  ${test_subnet_mask}  ${test_gateway}
2766cedca29SPrashanth Katti
277040c8c12SPrashanth KattiConfigure Invalid Netmask
278040c8c12SPrashanth Katti    [Documentation]  Verify error while setting invalid netmask.
279040c8c12SPrashanth Katti    [Tags]  Configure_Invalid_Netmask
280040c8c12SPrashanth Katti    [Template]  Add IP Address
281040c8c12SPrashanth Katti
282040c8c12SPrashanth Katti    # ip               subnet_mask         gateway          valid_status_codes
283040c8c12SPrashanth Katti    ${test_ipv4_addr}  ${invalid_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
284040c8c12SPrashanth Katti
285040c8c12SPrashanth KattiConfigure Out Of Range Netmask
286040c8c12SPrashanth Katti    [Documentation]  Verify error while setting out of range netmask.
287040c8c12SPrashanth Katti    [Tags]  Configure_Out_Of_Range_Netmask
288040c8c12SPrashanth Katti    [Template]  Add IP Address
289040c8c12SPrashanth Katti
290040c8c12SPrashanth Katti    # ip               subnet_mask              gateway          valid_status_codes
291040c8c12SPrashanth Katti    ${test_ipv4_addr}  ${out_of_range_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
292040c8c12SPrashanth Katti
293040c8c12SPrashanth KattiConfigure Alpha Netmask
294040c8c12SPrashanth Katti    [Documentation]  Verify error while setting alpha netmask.
295040c8c12SPrashanth Katti    [Tags]  Configure_Alpha_Netmask
296040c8c12SPrashanth Katti    [Template]  Add IP Address
297040c8c12SPrashanth Katti
298040c8c12SPrashanth Katti    # ip               subnet_mask       gateway          valid_status_codes
299040c8c12SPrashanth Katti    ${test_ipv4_addr}  ${alpha_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
300040c8c12SPrashanth Katti
301040c8c12SPrashanth KattiConfigure More Byte Netmask
302040c8c12SPrashanth Katti    [Documentation]  Verify error while setting more byte netmask.
303040c8c12SPrashanth Katti    [Tags]  Configure_More_Byte_Netmask
304040c8c12SPrashanth Katti    [Template]  Add IP Address
305040c8c12SPrashanth Katti
306040c8c12SPrashanth Katti    # ip               subnet_mask           gateway          valid_status_codes
307040c8c12SPrashanth Katti    ${test_ipv4_addr}  ${more_byte_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
308040c8c12SPrashanth Katti
309040c8c12SPrashanth KattiConfigure Less Byte Netmask
310040c8c12SPrashanth Katti    [Documentation]  Verify error while setting less byte netmask.
311040c8c12SPrashanth Katti    [Tags]  Configure_Less_Byte_Netmask
312040c8c12SPrashanth Katti    [Template]  Add IP Address
313040c8c12SPrashanth Katti
314040c8c12SPrashanth Katti    # ip               subnet_mask           gateway          valid_status_codes
315040c8c12SPrashanth Katti    ${test_ipv4_addr}  ${less_byte_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
316040c8c12SPrashanth Katti
317c6ad647fSPrashanth KattiConfigure Threshold Netmask And Verify
318c6ad647fSPrashanth Katti    [Documentation]  Configure threshold netmask and verify.
3195236ec54SGeorge Keishing    [Tags]  Configure_Threshold_Netmask_And_Verify
3209c7238daSAnvesh Kumar    [Teardown]  Run Keywords
3219c7238daSAnvesh Kumar    ...   Delete IP Address  ${test_ipv4_addr}  AND  Test Teardown Execution
322c6ad647fSPrashanth Katti
323c6ad647fSPrashanth Katti     Add IP Address  ${test_ipv4_addr}  ${threshold_netmask}  ${test_gateway}
324c6ad647fSPrashanth Katti
325c6ad647fSPrashanth KattiConfigure Lowest Netmask And Verify
326c6ad647fSPrashanth Katti    [Documentation]  Configure lowest netmask and verify.
3275236ec54SGeorge Keishing    [Tags]  Configure_Lowest_Netmask_And_Verify
3289c7238daSAnvesh Kumar    [Teardown]  Run Keywords
3299c7238daSAnvesh Kumar    ...   Delete IP Address  ${test_ipv4_addr}  AND  Test Teardown Execution
330c6ad647fSPrashanth Katti
331c6ad647fSPrashanth Katti     Add IP Address  ${test_ipv4_addr}  ${lowest_netmask}  ${test_gateway}
332c6ad647fSPrashanth Katti
333c6ad647fSPrashanth KattiConfigure Network ID
334c6ad647fSPrashanth Katti    [Documentation]  Verify error while configuring network ID.
335c6ad647fSPrashanth Katti    [Tags]  Configure_Network_ID
336c6ad647fSPrashanth Katti    [Template]  Add IP Address
337c6ad647fSPrashanth Katti    [Teardown]  Clear IP Settings On Fail  ${network_id}
338c6ad647fSPrashanth Katti
339c6ad647fSPrashanth Katti    # ip           subnet_mask          gateway          valid_status_codes
340c6ad647fSPrashanth Katti    ${network_id}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
341c6ad647fSPrashanth Katti
342c6ad647fSPrashanth KattiConfigure Less Octet IP
343c6ad647fSPrashanth Katti    [Documentation]  Verify error while Configuring less octet IP address.
344c6ad647fSPrashanth Katti    [Tags]  Configure_Less_Octet_IP
345c6ad647fSPrashanth Katti    [Template]  Add IP Address
346c6ad647fSPrashanth Katti
347c6ad647fSPrashanth Katti    # ip              subnet_mask          gateway          valid_status_codes
348c6ad647fSPrashanth Katti    ${less_octet_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
349c6ad647fSPrashanth Katti
350c6ad647fSPrashanth KattiConfigure Empty IP
351c6ad647fSPrashanth Katti    [Documentation]  Verify error while Configuring empty IP address.
352c6ad647fSPrashanth Katti    [Tags]  Configure_Empty_IP
353c6ad647fSPrashanth Katti    [Template]  Add IP Address
354c6ad647fSPrashanth Katti
355c6ad647fSPrashanth Katti    # ip      subnet_mask          gateway          valid_status_codes
356c6ad647fSPrashanth Katti    ${EMPTY}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
357c6ad647fSPrashanth Katti
358c6ad647fSPrashanth KattiConfigure Special Char IP
359c6ad647fSPrashanth Katti    [Documentation]  Configure invalid IP address containing special chars.
360c6ad647fSPrashanth Katti    [Tags]  Configure_Special_Char_IP
361c6ad647fSPrashanth Katti    [Template]  Add IP Address
362c6ad647fSPrashanth Katti
363c6ad647fSPrashanth Katti    # ip          subnet_mask          gateway          valid_status_codes
364c6ad647fSPrashanth Katti    @@@.%%.44.11  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
365c6ad647fSPrashanth Katti
366c6ad647fSPrashanth KattiConfigure Hexadecimal IP
367c6ad647fSPrashanth Katti    [Documentation]  Configure invalid IP address containing hex value.
368c6ad647fSPrashanth Katti    [Tags]  Configure_Hexadecimal_IP
369c6ad647fSPrashanth Katti    [Template]  Add IP Address
370c6ad647fSPrashanth Katti
371c6ad647fSPrashanth Katti    # ip       subnet_mask          gateway          valid_status_codes
372c6ad647fSPrashanth Katti    ${hex_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
373c6ad647fSPrashanth Katti
374c6ad647fSPrashanth KattiConfigure Negative Octet IP
375c6ad647fSPrashanth Katti    [Documentation]  Configure invalid IP address containing negative octet.
376c6ad647fSPrashanth Katti    [Tags]  Configure_Negative_Octet_IP
377c6ad647fSPrashanth Katti    [Template]  Add IP Address
378c6ad647fSPrashanth Katti
379c6ad647fSPrashanth Katti    # ip            subnet_mask          gateway          valid_status_codes
380c6ad647fSPrashanth Katti    ${negative_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST}
381c6ad647fSPrashanth Katti
3825cad5a07SPrashanth KattiConfigure Incomplete IP For Gateway
3835cad5a07SPrashanth Katti    [Documentation]  Configure incomplete IP for gateway and expect an error.
3845cad5a07SPrashanth Katti    [Tags]  Configure_Incomplete_IP_For_Gateway
3855cad5a07SPrashanth Katti    [Template]  Add IP Address
3865cad5a07SPrashanth Katti
3875cad5a07SPrashanth Katti    # ip               subnet_mask          gateway           valid_status_codes
3885cad5a07SPrashanth Katti    ${test_ipv4_addr}  ${test_subnet_mask}  ${less_octet_ip}  ${HTTP_BAD_REQUEST}
3895cad5a07SPrashanth Katti
3905cad5a07SPrashanth KattiConfigure Special Char IP For Gateway
3915cad5a07SPrashanth Katti    [Documentation]  Configure special char IP for gateway and expect an error.
3925cad5a07SPrashanth Katti    [Tags]  Configure_Special_Char_IP_For_Gateway
3935cad5a07SPrashanth Katti    [Template]  Add IP Address
3945cad5a07SPrashanth Katti
3955cad5a07SPrashanth Katti    # ip               subnet_mask          gateway       valid_status_codes
3965cad5a07SPrashanth Katti    ${test_ipv4_addr}  ${test_subnet_mask}  @@@.%%.44.11  ${HTTP_BAD_REQUEST}
3975cad5a07SPrashanth Katti
3985cad5a07SPrashanth KattiConfigure Hexadecimal IP For Gateway
3995cad5a07SPrashanth Katti    [Documentation]  Configure hexadecimal IP for gateway and expect an error.
4005cad5a07SPrashanth Katti    [Tags]  Configure_Hexadecimal_IP_For_Gateway
4015cad5a07SPrashanth Katti    [Template]  Add IP Address
4025cad5a07SPrashanth Katti
4035cad5a07SPrashanth Katti    # ip               subnet_mask          gateway    valid_status_codes
4045cad5a07SPrashanth Katti    ${test_ipv4_addr}  ${test_subnet_mask}  ${hex_ip}  ${HTTP_BAD_REQUEST}
4055cad5a07SPrashanth Katti
4067098c976SPrashanth KattiGet DNS Server And Verify
4077098c976SPrashanth Katti    [Documentation]  Get DNS server via Redfish and verify.
4087098c976SPrashanth Katti    [Tags]  Get_DNS_Server_And_Verify
4097098c976SPrashanth Katti
4107098c976SPrashanth Katti    Verify CLI and Redfish Nameservers
4117098c976SPrashanth Katti
4127098c976SPrashanth KattiConfigure DNS Server And Verify
4137098c976SPrashanth Katti    [Documentation]  Configure DNS server and verify.
4147098c976SPrashanth Katti    [Tags]  Configure_DNS_Server_And_Verify
415c85957cdSPrashanth Katti    [Setup]  DNS Test Setup Execution
4167098c976SPrashanth Katti    [Teardown]  Run Keywords
4177098c976SPrashanth Katti    ...  Configure Static Name Servers  AND  Test Teardown Execution
4187098c976SPrashanth Katti
4197098c976SPrashanth Katti    Configure Static Name Servers  ${static_name_servers}
4207098c976SPrashanth Katti    Verify CLI and Redfish Nameservers
4217098c976SPrashanth Katti
422c85957cdSPrashanth KattiDelete DNS Server And Verify
423c85957cdSPrashanth Katti    [Documentation]  Delete DNS server and verify.
424c85957cdSPrashanth Katti    [Tags]  Delete_DNS_Server_And_Verify
425c85957cdSPrashanth Katti    [Setup]  DNS Test Setup Execution
426c85957cdSPrashanth Katti    [Teardown]  Run Keywords
427c85957cdSPrashanth Katti    ...  Configure Static Name Servers  AND  Test Teardown Execution
428c85957cdSPrashanth Katti
429c85957cdSPrashanth Katti    Delete Static Name Servers
430c85957cdSPrashanth Katti    Verify CLI and Redfish Nameservers
431c85957cdSPrashanth Katti
432c85957cdSPrashanth KattiConfigure DNS Server And Check Persistency
433c85957cdSPrashanth Katti    [Documentation]  Configure DNS server and check persistency on reboot.
434c85957cdSPrashanth Katti    [Tags]  Configure_DNS_Server_And_Check_Persistency
435c85957cdSPrashanth Katti    [Setup]  DNS Test Setup Execution
436c85957cdSPrashanth Katti    [Teardown]  Run Keywords
437c85957cdSPrashanth Katti    ...  Configure Static Name Servers  AND  Test Teardown Execution
438c85957cdSPrashanth Katti
439c85957cdSPrashanth Katti    Configure Static Name Servers  ${static_name_servers}
440c85957cdSPrashanth Katti    # Reboot BMC and verify persistency.
44163f0b10cSSweta Potthuri    Redfish OBMC Reboot (off)  stack_mode=skip
4428c628b70SAnves Kumar rayankula    Redfish.Login
443c85957cdSPrashanth Katti    Verify CLI and Redfish Nameservers
444c85957cdSPrashanth Katti
4453063ffefSPrashanth KattiConfigure Loopback IP For Gateway
4463063ffefSPrashanth Katti    [Documentation]  Configure loopback IP for gateway and expect an error.
4473063ffefSPrashanth Katti    [Tags]  Configure_Loopback_IP_For_Gateway
4483063ffefSPrashanth Katti    [Template]  Add IP Address
4493063ffefSPrashanth Katti    [Teardown]  Clear IP Settings On Fail  ${test_ipv4_addr}
4503063ffefSPrashanth Katti
4513063ffefSPrashanth Katti    # ip               subnet_mask          gateway         valid_status_codes
4523063ffefSPrashanth Katti    ${test_ipv4_addr}  ${test_subnet_mask}  ${loopback_ip}  ${HTTP_BAD_REQUEST}
4533063ffefSPrashanth Katti
4543063ffefSPrashanth KattiConfigure Network ID For Gateway
4553063ffefSPrashanth Katti    [Documentation]  Configure network ID for gateway and expect an error.
4563063ffefSPrashanth Katti    [Tags]  Configure_Network_ID_For_Gateway
4573063ffefSPrashanth Katti    [Template]  Add IP Address
4583063ffefSPrashanth Katti    [Teardown]  Clear IP Settings On Fail  ${test_ipv4_addr}
4593063ffefSPrashanth Katti
4603063ffefSPrashanth Katti    # ip               subnet_mask          gateway        valid_status_codes
4613063ffefSPrashanth Katti    ${test_ipv4_addr}  ${test_subnet_mask}  ${network_id}  ${HTTP_BAD_REQUEST}
4623063ffefSPrashanth Katti
4633063ffefSPrashanth KattiConfigure Multicast IP For Gateway
4643063ffefSPrashanth Katti    [Documentation]  Configure multicast IP for gateway and expect an error.
4653063ffefSPrashanth Katti    [Tags]  Configure_Multicast_IP_For_Gateway
4663063ffefSPrashanth Katti    [Template]  Add IP Address
4673063ffefSPrashanth Katti    [Teardown]  Clear IP Settings On Fail  ${test_ipv4_addr}
4683063ffefSPrashanth Katti
4693063ffefSPrashanth Katti    # ip               subnet_mask          gateway           valid_status_codes
470412c6680STony Lee    ${test_ipv4_addr}  ${test_subnet_mask}  ${multicast_ip}  ${HTTP_BAD_REQUEST}
4713063ffefSPrashanth Katti
4723063ffefSPrashanth KattiConfigure Broadcast IP For Gateway
4733063ffefSPrashanth Katti    [Documentation]  Configure broadcast IP for gateway and expect an error.
4743063ffefSPrashanth Katti    [Tags]  Configure_Broadcast_IP_For_Gateway
4753063ffefSPrashanth Katti    [Template]  Add IP Address
4763063ffefSPrashanth Katti    [Teardown]  Clear IP Settings On Fail  ${test_ipv4_addr}
4773063ffefSPrashanth Katti
4783063ffefSPrashanth Katti    # ip               subnet_mask          gateway          valid_status_codes
4793063ffefSPrashanth Katti    ${test_ipv4_addr}  ${test_subnet_mask}  ${broadcast_ip}  ${HTTP_BAD_REQUEST}
480c85957cdSPrashanth Katti
4813c7b6439SPrashanth KattiConfigure Null Value For DNS Server
4823c7b6439SPrashanth Katti    [Documentation]  Configure null value for DNS server and expect an error.
4833c7b6439SPrashanth Katti    [Tags]  Configure_Null_Value_For_DNS_Server
4843c7b6439SPrashanth Katti    [Setup]  DNS Test Setup Execution
4853c7b6439SPrashanth Katti    [Teardown]  Run Keywords
4863c7b6439SPrashanth Katti    ...  Configure Static Name Servers  AND  Test Teardown Execution
4873c7b6439SPrashanth Katti
4883c7b6439SPrashanth Katti    Configure Static Name Servers  ${null_value}  ${HTTP_BAD_REQUEST}
4893c7b6439SPrashanth Katti
490afe16b72SPrashanth KattiConfigure Empty Value For DNS Server
491afe16b72SPrashanth Katti    [Documentation]  Configure empty value for DNS server and expect an error.
492afe16b72SPrashanth Katti    [Tags]  Configure_Empty_Value_For_DNS_Server
493afe16b72SPrashanth Katti    [Setup]  DNS Test Setup Execution
494afe16b72SPrashanth Katti    [Teardown]  Run Keywords
495afe16b72SPrashanth Katti    ...  Configure Static Name Servers  AND  Test Teardown Execution
496afe16b72SPrashanth Katti
497afe16b72SPrashanth Katti    Configure Static Name Servers  ${empty_dictionary}  ${HTTP_BAD_REQUEST}
498afe16b72SPrashanth Katti
499afe16b72SPrashanth KattiConfigure String Value For DNS Server
500afe16b72SPrashanth Katti    [Documentation]  Configure string value for DNS server and expect an error.
501afe16b72SPrashanth Katti    [Tags]  Configure_String_Value_For_DNS_Server
502afe16b72SPrashanth Katti    [Setup]  DNS Test Setup Execution
503afe16b72SPrashanth Katti    [Teardown]  Run Keywords
504afe16b72SPrashanth Katti    ...  Configure Static Name Servers  AND  Test Teardown Execution
505afe16b72SPrashanth Katti
506afe16b72SPrashanth Katti    Configure Static Name Servers  ${string_value}  ${HTTP_BAD_REQUEST}
507afe16b72SPrashanth Katti
508568df5f1SPrashanth KattiModify IPv4 Address And Verify
509568df5f1SPrashanth Katti    [Documentation]  Modify IP address via Redfish and verify.
5100c8100ffSGeorge Keishing    [Tags]  Modify_IPv4_Address_And_Verify
511568df5f1SPrashanth Katti    [Teardown]  Run Keywords
512045814b3SAnves Kumar rayankula    ...  Delete IP Address  ${test_ipv4_addr2}  AND  Test Teardown Execution
513568df5f1SPrashanth Katti
514568df5f1SPrashanth Katti     Add IP Address  ${test_ipv4_addr}  ${test_subnet_mask}  ${test_gateway}
515568df5f1SPrashanth Katti
516568df5f1SPrashanth Katti     Update IP Address  ${test_ipv4_addr}  ${test_ipv4_addr2}  ${test_subnet_mask}  ${test_gateway}
517568df5f1SPrashanth Katti
5186e70478eSSweta PotthuriVerify Modifying IP Address Multiple Times
5196e70478eSSweta Potthuri    [Documentation]  Verify modifying IP address multiple times.
5206e70478eSSweta Potthuri    [Tags]  Verify_Modifying_IP_Address_Multiple_Times
5216e70478eSSweta Potthuri    [Teardown]  Run Keywords
5226e70478eSSweta Potthuri    ...  Delete IP Address  ${test_ipv4_addr}  AND  Test Teardown Execution
5236e70478eSSweta Potthuri
5246e70478eSSweta Potthuri    Add IP Address  ${test_ipv4_addr}  ${test_subnet_mask}  ${test_gateway}
5256e70478eSSweta Potthuri    Update IP Address  ${test_ipv4_addr}  ${test_ipv4_addr2}  ${test_subnet_mask}  ${test_gateway}
526e392cc7dSSweta Potthuri    Update IP Address  ${test_ipv4_addr2}  ${test_ipv4_addr}  ${test_subnet_mask}  ${test_gateway}
5279c7238daSAnvesh Kumar
5286b9fcd1aSAnves Kumar rayankulaConfigure Invalid Values For DNS Server
5296b9fcd1aSAnves Kumar rayankula    [Documentation]  Configure invalid values for DNS server and expect an error.
5305236ec54SGeorge Keishing    [Tags]  Configure_Invalid_Values_For_DNS_Server
5316b9fcd1aSAnves Kumar rayankula    [Setup]  DNS Test Setup Execution
5326b9fcd1aSAnves Kumar rayankula    [Template]  Configure Static Name Servers
5336b9fcd1aSAnves Kumar rayankula    [Teardown]  Run Keywords
5346b9fcd1aSAnves Kumar rayankula    ...  Configure Static Name Servers  AND  Test Teardown Execution
5356b9fcd1aSAnves Kumar rayankula
5366b9fcd1aSAnves Kumar rayankula     # static_name_servers        valid_status_codes
5376b9fcd1aSAnves Kumar rayankula      0xa.0xb.0xc.0xd             ${HTTP_BAD_REQUEST}
5386b9fcd1aSAnves Kumar rayankula      10.-7.-7.-7                 ${HTTP_BAD_REQUEST}
5396b9fcd1aSAnves Kumar rayankula      10.3.36                     ${HTTP_BAD_REQUEST}
5406b9fcd1aSAnves Kumar rayankula      @@@.%%.44.11                ${HTTP_BAD_REQUEST}
5416b9fcd1aSAnves Kumar rayankula
5426b9fcd1aSAnves Kumar rayankula
5436b9fcd1aSAnves Kumar rayankulaConfig Multiple DNS Servers And Verify
5446b9fcd1aSAnves Kumar rayankula    [Documentation]  Config multiple DNS servers and verify.
5456b9fcd1aSAnves Kumar rayankula    [Tags]  Config_Multiple_DNS_Servers_And_Verify
5466b9fcd1aSAnves Kumar rayankula    [Setup]  DNS Test Setup Execution
5476b9fcd1aSAnves Kumar rayankula    [Teardown]  Run Keywords
5486b9fcd1aSAnves Kumar rayankula    ...  Configure Static Name Servers  AND  Test Teardown Execution
5496b9fcd1aSAnves Kumar rayankula
5506b9fcd1aSAnves Kumar rayankula     @{list_name_servers}=  Create List  10.5.5.10  10.20.5.10  10.5.6.7
5516b9fcd1aSAnves Kumar rayankula     Configure Static Name Servers  ${list_name_servers}
5526b9fcd1aSAnves Kumar rayankula     Verify CLI and Redfish Nameservers
5536b9fcd1aSAnves Kumar rayankula
5546b9fcd1aSAnves Kumar rayankula
555d4cdd8c0SAnves Kumar rayankulaConfigure And Verify Multiple Static IPv4 Addresses
556d4cdd8c0SAnves Kumar rayankula    [Documentation]  Configure multiple static ipv4 address via Redfish and verify.
557d4cdd8c0SAnves Kumar rayankula    [Tags]  Configure_And_Verify_Multiple_Static_IPv4_Addresses
558d4cdd8c0SAnves Kumar rayankula    [Teardown]  Run Keywords  Delete Multiple Static IPv4 Addresses  ${test_ipv4_addresses}
559d4cdd8c0SAnves Kumar rayankula    ...  AND  Test Teardown Execution
560d4cdd8c0SAnves Kumar rayankula
561d4cdd8c0SAnves Kumar rayankula    ${test_ipv4_addresses}=  Create List  ${test_ipv4_addr}  ${test_ipv4_addr2}
562d4cdd8c0SAnves Kumar rayankula    Configure Multiple Static IPv4 Addresses   ${test_ipv4_addresses}  ${test_subnet_mask}  ${test_gateway}
563d4cdd8c0SAnves Kumar rayankula
564d4cdd8c0SAnves Kumar rayankula
565d4cdd8c0SAnves Kumar rayankulaConfigure Multiple Static IPv4 Addresses And Check Persistency
566d4cdd8c0SAnves Kumar rayankula    [Documentation]  Configure multiple static ipv4 address via Redfish and check persistency.
567d4cdd8c0SAnves Kumar rayankula    [Tags]  Configure_Multiple_Static_IPv4_Addresses_And_Check_Persistency
568d4cdd8c0SAnves Kumar rayankula    [Teardown]  Run Keywords  Delete Multiple Static IPv4 Addresses  ${test_ipv4_addresses}
569d4cdd8c0SAnves Kumar rayankula    ...  AND  Test Teardown Execution
570d4cdd8c0SAnves Kumar rayankula
571d4cdd8c0SAnves Kumar rayankula    ${test_ipv4_addresses}=  Create List  ${test_ipv4_addr}  ${test_ipv4_addr2}
572d4cdd8c0SAnves Kumar rayankula    Configure Multiple Static IPv4 Addresses  ${test_ipv4_addresses}  ${test_subnet_mask}  ${test_gateway}
573d4cdd8c0SAnves Kumar rayankula
574d4cdd8c0SAnves Kumar rayankula    # Reboot BMC and verify persistency.
57563f0b10cSSweta Potthuri    Redfish OBMC Reboot (off)  stack_mode=skip
5768c628b70SAnves Kumar rayankula    Redfish.Login
577d4cdd8c0SAnves Kumar rayankula    FOR  ${ip}  IN  @{test_ipv4_addresses}
578d4cdd8c0SAnves Kumar rayankula      Verify IP And Netmask On BMC  ${ip}  ${test_subnet_mask}
57960784a43Snagarjunb22      Verify IP On Redfish URI  ${ip}
580d4cdd8c0SAnves Kumar rayankula    END
581d4cdd8c0SAnves Kumar rayankula
582d4cdd8c0SAnves Kumar rayankula
58343e93e14SAnves Kumar rayankulaConfigure And Verify Multiple IPv4 Addresses
58443e93e14SAnves Kumar rayankula    [Documentation]  Configure multiple IPv4 addresses and verify.
5850c8100ffSGeorge Keishing    [Tags]  Configure_And_Verify_Multiple_IPv4_Addresses
58643e93e14SAnves Kumar rayankula    [Teardown]  Run Keywords
58743e93e14SAnves Kumar rayankula    ...  Delete IP Address  ${test_ipv4_addr}  AND  Delete IP Address  ${test_ipv4_addr2}
58843e93e14SAnves Kumar rayankula    ...  AND  Test Teardown Execution
58943e93e14SAnves Kumar rayankula
59043e93e14SAnves Kumar rayankula    ${ip1}=  Create dictionary  Address=${test_ipv4_addr}
59143e93e14SAnves Kumar rayankula    ...  SubnetMask=255.255.0.0  Gateway=${test_gateway}
59243e93e14SAnves Kumar rayankula    ${ip2}=  Create dictionary  Address=${test_ipv4_addr2}
59343e93e14SAnves Kumar rayankula    ...  SubnetMask=255.255.252.0  Gateway=${test_gateway}
59443e93e14SAnves Kumar rayankula
59543e93e14SAnves Kumar rayankula    ${empty_dict}=  Create Dictionary
59643e93e14SAnves Kumar rayankula    ${patch_list}=  Create List
59743e93e14SAnves Kumar rayankula    ${network_configurations}=  Get Network Configuration
59843e93e14SAnves Kumar rayankula    ${num_entries}=  Get Length  ${network_configurations}
59943e93e14SAnves Kumar rayankula
60043e93e14SAnves Kumar rayankula    FOR  ${INDEX}  IN RANGE  0  ${num_entries}
60143e93e14SAnves Kumar rayankula      Append To List  ${patch_list}  ${empty_dict}
60243e93e14SAnves Kumar rayankula    END
60343e93e14SAnves Kumar rayankula
60443e93e14SAnves Kumar rayankula    # We need not check for existence of IP on BMC while adding.
60543e93e14SAnves Kumar rayankula    Append To List  ${patch_list}  ${ip1}  ${ip2}
60643e93e14SAnves Kumar rayankula    ${payload}=  Create Dictionary  IPv4StaticAddresses=${patch_list}
60743e93e14SAnves Kumar rayankula    ${active_channel_config}=  Get Active Channel Config
60843e93e14SAnves Kumar rayankula    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
60943e93e14SAnves Kumar rayankula    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  body=&{payload}
61053b8030fSAnves Kumar rayankula    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
61143e93e14SAnves Kumar rayankula
61243e93e14SAnves Kumar rayankula    # Note: Network restart takes around 15-18s after patch request processing.
61343e93e14SAnves Kumar rayankula    Sleep  ${NETWORK_TIMEOUT}s
61443e93e14SAnves Kumar rayankula    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
61543e93e14SAnves Kumar rayankula    Verify IP On BMC  ${test_ipv4_addr}
61643e93e14SAnves Kumar rayankula    Verify IP On BMC  ${test_ipv4_addr2}
61743e93e14SAnves Kumar rayankula
61843e93e14SAnves Kumar rayankula
619eefdb564SAnves Kumar rayankulaConfig Multiple DNS Servers And Check Persistency
620eefdb564SAnves Kumar rayankula    [Documentation]  Config multiple DNS and check persistency.
621eefdb564SAnves Kumar rayankula    [Tags]  Config_Multiple_DNS_Servers_And_Check_Persistency
622eefdb564SAnves Kumar rayankula    [Setup]  DNS Test Setup Execution
623eefdb564SAnves Kumar rayankula    [Teardown]  Run Keywords
624eefdb564SAnves Kumar rayankula    ...  Configure Static Name Servers  AND  Test Teardown Execution
625eefdb564SAnves Kumar rayankula
626eefdb564SAnves Kumar rayankula    @{list_name_servers}=  Create List  10.5.5.10  10.20.5.10  10.5.6.7
627eefdb564SAnves Kumar rayankula    Configure Static Name Servers  ${list_name_servers}
628eefdb564SAnves Kumar rayankula
629eefdb564SAnves Kumar rayankula    # Reboot BMC and verify persistency.
63063f0b10cSSweta Potthuri    Redfish OBMC Reboot (off)  stack_mode=skip
631eefdb564SAnves Kumar rayankula    Redfish.Login
632eefdb564SAnves Kumar rayankula    Verify CLI and Redfish Nameservers
633eefdb564SAnves Kumar rayankula
6342f137ebeSAnves Kumar rayankula
6352f137ebeSAnves Kumar rayankulaConfigure Static IP Without Using Gateway And Verify
6362f137ebeSAnves Kumar rayankula    [Documentation]  Configure static IP without using gateway and verify error.
6372f137ebeSAnves Kumar rayankula    [Tags]  Configure_Static_IP_Without_Using_Gateway_And_Verify
6382f137ebeSAnves Kumar rayankula
6392f137ebeSAnves Kumar rayankula    ${ip}=  Create dictionary  Address=${test_ipv4_addr}
6402f137ebeSAnves Kumar rayankula    ...  SubnetMask=${test_subnet_mask}
6412f137ebeSAnves Kumar rayankula    ${empty_dict}=  Create Dictionary
6422f137ebeSAnves Kumar rayankula    ${patch_list}=  Create List
6432f137ebeSAnves Kumar rayankula    ${network_configurations}=  Get Network Configuration
6442f137ebeSAnves Kumar rayankula
6452f137ebeSAnves Kumar rayankula    ${num_entries}=  Get Length  ${network_configurations}
6462f137ebeSAnves Kumar rayankula    FOR  ${INDEX}  IN RANGE  0  ${num_entries}
6472f137ebeSAnves Kumar rayankula      Append To List  ${patch_list}  ${empty_dict}
6482f137ebeSAnves Kumar rayankula    END
6492f137ebeSAnves Kumar rayankula
6502f137ebeSAnves Kumar rayankula    # We need not check for existence of IP on BMC while adding.
6512f137ebeSAnves Kumar rayankula    Append To List  ${patch_list}  ${ip}
6522f137ebeSAnves Kumar rayankula    ${payload}=  Create Dictionary  IPv4StaticAddresses=${patch_list}
6532f137ebeSAnves Kumar rayankula    ${active_channel_config}=  Get Active Channel Config
6542f137ebeSAnves Kumar rayankula    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
6552f137ebeSAnves Kumar rayankula    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
6562f137ebeSAnves Kumar rayankula    ...  body=&{payload}  valid_status_codes=[${HTTP_BAD_REQUEST}]
6572f137ebeSAnves Kumar rayankula
658ac0a7bafSAnves Kumar rayankula
659ac0a7bafSAnves Kumar rayankulaTest Network Response On Specified Host State
660ac0a7bafSAnves Kumar rayankula    [Documentation]  Verifying the BMC network response when host is on and off.
661ac0a7bafSAnves Kumar rayankula    [Tags]  Test_Network_Response_On_Specified_Host_State
662ac0a7bafSAnves Kumar rayankula    [Template]  Verify Network Response On Specified Host State
663ac0a7bafSAnves Kumar rayankula
664ac0a7bafSAnves Kumar rayankula    # host_state
665ac0a7bafSAnves Kumar rayankula    on
666ac0a7bafSAnves Kumar rayankula    off
667ac0a7bafSAnves Kumar rayankula
668fb001363SSweta Potthuri
669f58cce03SPrashanth Katti*** Keywords ***
670f58cce03SPrashanth Katti
671f58cce03SPrashanth KattiTest Setup Execution
672f58cce03SPrashanth Katti    [Documentation]  Test setup execution.
673f58cce03SPrashanth Katti
67497c93945SGeorge Keishing    Redfish.Login
675f58cce03SPrashanth Katti
676f58cce03SPrashanth Katti    @{network_configurations}=  Get Network Configuration
677f58cce03SPrashanth Katti    Set Test Variable  @{network_configurations}
678f58cce03SPrashanth Katti
679f58cce03SPrashanth Katti    # Get BMC IP address and prefix length.
680f58cce03SPrashanth Katti    ${ip_data}=  Get BMC IP Info
681f58cce03SPrashanth Katti    Set Test Variable  ${ip_data}
682f58cce03SPrashanth Katti
683747ce9d0SPrashanth Katti
684747ce9d0SPrashanth KattiVerify Netmask On BMC
685747ce9d0SPrashanth Katti    [Documentation]  Verify netmask on BMC.
686f58cce03SPrashanth Katti    [Arguments]  ${netmask}
687f58cce03SPrashanth Katti
688f58cce03SPrashanth Katti    # Description of the argument(s):
689f58cce03SPrashanth Katti    # netmask  netmask value to be verified.
690f58cce03SPrashanth Katti
691747ce9d0SPrashanth Katti    ${prefix_length}=  Netmask Prefix Length  ${netmask}
692747ce9d0SPrashanth Katti
693747ce9d0SPrashanth Katti    Should Contain Match  ${ip_data}  */${prefix_length}
694747ce9d0SPrashanth Katti    ...  msg=Prefix length does not exist.
695f58cce03SPrashanth Katti
6962c5c3bbdSPrashanth KattiVerify IP And Netmask On BMC
6972c5c3bbdSPrashanth Katti    [Documentation]  Verify IP and netmask on BMC.
6982c5c3bbdSPrashanth Katti    [Arguments]  ${ip}  ${netmask}
6992c5c3bbdSPrashanth Katti
7002c5c3bbdSPrashanth Katti    # Description of the argument(s):
7012c5c3bbdSPrashanth Katti    # ip       IP address to be verified.
7022c5c3bbdSPrashanth Katti    # netmask  netmask value to be verified.
7032c5c3bbdSPrashanth Katti
7042c5c3bbdSPrashanth Katti    ${prefix_length}=  Netmask Prefix Length  ${netmask}
7052c5c3bbdSPrashanth Katti    @{ip_data}=  Get BMC IP Info
7062c5c3bbdSPrashanth Katti
7072c5c3bbdSPrashanth Katti    ${ip_with_netmask}=  Catenate  ${ip}/${prefix_length}
7082c5c3bbdSPrashanth Katti    Should Contain  ${ip_data}  ${ip_with_netmask}
7092c5c3bbdSPrashanth Katti    ...  msg=IP and netmask pair does not exist.
7102c5c3bbdSPrashanth Katti
711f58cce03SPrashanth KattiTest Teardown Execution
712f58cce03SPrashanth Katti    [Documentation]  Test teardown execution.
713f58cce03SPrashanth Katti
714f58cce03SPrashanth Katti    FFDC On Test Case Fail
71597c93945SGeorge Keishing    Redfish.Logout
716a8442516SPrashanth Katti
717a8442516SPrashanth KattiClear IP Settings On Fail
718a8442516SPrashanth Katti    [Documentation]  Clear IP settings on fail.
719a8442516SPrashanth Katti    [Arguments]  ${ip}
720a8442516SPrashanth Katti
721a8442516SPrashanth Katti    # Description of argument(s):
722a8442516SPrashanth Katti    # ip  IP address to be deleted.
723a8442516SPrashanth Katti
724a8442516SPrashanth Katti    Run Keyword If  '${TEST STATUS}' == 'FAIL'
725a8442516SPrashanth Katti    ...  Delete IP Address  ${ip}
726a8442516SPrashanth Katti
727a8442516SPrashanth Katti    Test Teardown Execution
728adf0b4e7SPrashanth Katti
7297098c976SPrashanth KattiVerify CLI and Redfish Nameservers
7307098c976SPrashanth Katti    [Documentation]  Verify that nameservers obtained via Redfish do not
7317098c976SPrashanth Katti    ...  match those found in /etc/resolv.conf.
7327098c976SPrashanth Katti
733412c6680STony Lee    ${active_channel_config}=  Get Active Channel Config
734412c6680STony Lee    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
735412c6680STony Lee
73691548eaeSAnves Kumar rayankula    ${redfish_nameservers}=  Redfish.Get Attribute
73791548eaeSAnves Kumar rayankula    ...  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}  StaticNameServers
7387098c976SPrashanth Katti    ${resolve_conf_nameservers}=  CLI Get Nameservers
73939c00518SMichael Walsh    Rqprint Vars  redfish_nameservers  resolve_conf_nameservers
7407098c976SPrashanth Katti
741d77ea988SSweta Potthuri    List Should Contain Sub List  ${resolve_conf_nameservers}  ${redfish_nameservers}
742d77ea988SSweta Potthuri    ...  msg=The nameservers obtained via Redfish do not match those found in /etc/resolv.conf.
7437098c976SPrashanth Katti
744b478d90eSPrashanth KattiSuite Setup Execution
745b478d90eSPrashanth Katti    [Documentation]  Do suite setup execution.
746b478d90eSPrashanth Katti
747ca054eeeSaravinth0510    # - Get DHCP IPv4 enabled/disabled status from redfish managers URI
748ca054eeeSaravinth0510    # - If DHCP IPv4 is enabled ,
749ca054eeeSaravinth0510    #   - Get DHCP IPv4 settings - ip address, gateway, subnetmask
750ca054eeeSaravinth0510    #   - And set the same as static IP address
751ca054eeeSaravinth0510
7521ac4221dSGeorge Keishing    Redfish.Login
75359188b61SAnvesh Kumar    ${DHCPEnabled}=  Get IPv4 DHCP Enabled Status   ${CHANNEL_NUMBER}
754ca054eeeSaravinth0510    Set Suite Variable  ${DHCPEnabled}
755ca054eeeSaravinth0510
75659188b61SAnvesh Kumar    ${ip_addr}  ${gateway}  ${subnetmask}=  Run Keyword If  ${DHCPEnabled}==True
75759188b61SAnvesh Kumar    ...   Get DHCP IP Info
75859188b61SAnvesh Kumar
759ca054eeeSaravinth0510    Run Keyword If  ${DHCPEnabled}==True
76059188b61SAnvesh Kumar    ...  Add IP Address  ${ip_addr}  ${subnetmask}  ${gateway}
761ca054eeeSaravinth0510
762b478d90eSPrashanth Katti    ${test_gateway}=  Get BMC Default Gateway
763b478d90eSPrashanth Katti    Set Suite Variable  ${test_gateway}
764568df5f1SPrashanth Katti
765ca054eeeSaravinth0510
766ca054eeeSaravinth0510Suite Teardown Execution
767ca054eeeSaravinth0510    [Documentation]  Do suite teardown execution.
768ca054eeeSaravinth0510
769ca054eeeSaravinth0510    # - If the DHCP IPv4 is enabled before suite setup execution
770ca054eeeSaravinth0510    #   - Restore the DHCP IPv4 to enabled state
771ca054eeeSaravinth0510
77259188b61SAnvesh Kumar    Redfish.Login
773ca054eeeSaravinth0510    Run Keyword If  ${DHCPEnabled}==True
774ca054eeeSaravinth0510    ...  Enable IPv4 DHCP Settings
775ca054eeeSaravinth0510
776ca054eeeSaravinth0510
777d4cdd8c0SAnves Kumar rayankulaConfigure Multiple Static IPv4 Addresses
778d4cdd8c0SAnves Kumar rayankula    [Documentation]  Configure multiple static ipv4 address via Redfish and verify.
779d4cdd8c0SAnves Kumar rayankula    [Arguments]  ${ip_addreses}  ${subnet_mask}  ${gateway}
780d4cdd8c0SAnves Kumar rayankula
781d4cdd8c0SAnves Kumar rayankula    # Description of argument(s):
782d4cdd8c0SAnves Kumar rayankula    # ip_addreses         A list of IP addresses to be added (e.g.["10.7.7.7"]).
783d4cdd8c0SAnves Kumar rayankula    # subnet_mask         Subnet mask for the IP to be added (e.g. "255.255.0.0").
784d4cdd8c0SAnves Kumar rayankula    # gateway             Gateway for the IP to be added (e.g. "10.7.7.1").
785d4cdd8c0SAnves Kumar rayankula
786d4cdd8c0SAnves Kumar rayankula    FOR  ${ip}  IN   @{ip_addreses}
787d4cdd8c0SAnves Kumar rayankula       Add IP Address  ${ip}  ${subnet_mask}  ${gateway}
788d4cdd8c0SAnves Kumar rayankula    END
789d4cdd8c0SAnves Kumar rayankula    Validate Network Config On BMC
790d4cdd8c0SAnves Kumar rayankula
791d4cdd8c0SAnves Kumar rayankula
792d4cdd8c0SAnves Kumar rayankulaDelete Multiple Static IPv4 Addresses
793d4cdd8c0SAnves Kumar rayankula    [Documentation]  Delete multiple static ipv4 address via Redfish.
794d4cdd8c0SAnves Kumar rayankula    [Arguments]  ${ip_addreses}
795d4cdd8c0SAnves Kumar rayankula
796d4cdd8c0SAnves Kumar rayankula    # Description of argument(s):
797d4cdd8c0SAnves Kumar rayankula    # ip_addreses         A list of IP addresses to be deleted (e.g.["10.7.7.7"]).
798d4cdd8c0SAnves Kumar rayankula
799d4cdd8c0SAnves Kumar rayankula    FOR  ${ip}  IN   @{ip_addreses}
800d4cdd8c0SAnves Kumar rayankula       Delete IP Address  ${ip}
801d4cdd8c0SAnves Kumar rayankula    END
802d4cdd8c0SAnves Kumar rayankula    Validate Network Config On BMC
803ac0a7bafSAnves Kumar rayankula
804ac0a7bafSAnves Kumar rayankulaVerify Network Response On Specified Host State
805ac0a7bafSAnves Kumar rayankula    [Documentation]  Verifying the BMC network response when host is on and off.
806ac0a7bafSAnves Kumar rayankula    [Arguments]  ${host_state}
807ac0a7bafSAnves Kumar rayankula
808ac0a7bafSAnves Kumar rayankula    # Description of argument(s):
809ac0a7bafSAnves Kumar rayankula    # host_state   if host_state is on then host is booted to operating system.
810ac0a7bafSAnves Kumar rayankula    #              if host_state is off then host is power off.
811ac0a7bafSAnves Kumar rayankula    #              (eg. on, off).
812ac0a7bafSAnves Kumar rayankula
813ac0a7bafSAnves Kumar rayankula    ${active_channel_config}=  Get Active Channel Config
814ac0a7bafSAnves Kumar rayankula    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
815ac0a7bafSAnves Kumar rayankula
816ac0a7bafSAnves Kumar rayankula    Run Keyword If  '${host_state}' == 'on'
817ac0a7bafSAnves Kumar rayankula    ...    Redfish Power On  stack_mode=skip
818ac0a7bafSAnves Kumar rayankula    ...  ELSE
819ac0a7bafSAnves Kumar rayankula    ...    Redfish Power off  stack_mode=skip
820ac0a7bafSAnves Kumar rayankula
821ac0a7bafSAnves Kumar rayankula    Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
822ac0a7bafSAnves Kumar rayankula    Ping Host  ${OPENBMC_HOST}
823ac0a7bafSAnves Kumar rayankula
82460784a43Snagarjunb22
82560784a43Snagarjunb22Verify IP On Redfish URI
82660784a43Snagarjunb22    [Documentation]  Verify given IP on redfish URI.
82760784a43Snagarjunb22    [Arguments]  ${ip_address}
82860784a43Snagarjunb22
82960784a43Snagarjunb22    # Description of argument(s):
83060784a43Snagarjunb22    # ip_address   Configured IP address which need to verified.
83160784a43Snagarjunb22
83260784a43Snagarjunb22    ${network_configurations}=  Get Network Configuration
83360784a43Snagarjunb22
83460784a43Snagarjunb22    FOR  ${network_configuration}  IN  @{network_configurations}
83560784a43Snagarjunb22        ${ip_found}=  Set Variable If  '${network_configuration['Address']}' == '${ip_address}'  ${True}
83660784a43Snagarjunb22        ...  ${False}
83760784a43Snagarjunb22        Exit For Loop If  ${ip_found}
83860784a43Snagarjunb22    END
83960784a43Snagarjunb22    Run Keyword If  '${ip_found}' == '${False}'
84060784a43Snagarjunb22    ...  Fail  msg=Configured IP address not found on EthernetInterface URI.
841ca054eeeSaravinth0510
842ca054eeeSaravinth0510
843ca054eeeSaravinth0510Enable IPv4 DHCP Settings
844ca054eeeSaravinth0510    [Documentation]  Set IPv4 DHCP enabled status true/false in redfish URI.
845ca054eeeSaravinth0510    [Arguments]  ${status}=${True}
846ca054eeeSaravinth0510
847ca054eeeSaravinth0510    # Description of argument(s):
848ca054eeeSaravinth0510    # status   IPv4 DHCPEnabled status which needs to be set.
849ca054eeeSaravinth0510    #          (e.g. True or False)
850ca054eeeSaravinth0510
851ca054eeeSaravinth0510    ${active_channel_config}=  Get Active Channel Config
852ca054eeeSaravinth0510    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
853ca054eeeSaravinth0510    ${DHCPv4}=  Create Dictionary  DHCPEnabled=${status}
854ca054eeeSaravinth0510
855ca054eeeSaravinth0510    ${payload}=  Create Dictionary  DHCPv4=${DHCPv4}
856ca054eeeSaravinth0510    Redfish.patch  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
857ca054eeeSaravinth0510    ...  body=&{payload}  valid_status_codes=[${HTTP_NO_CONTENT}, ${HTTP_OK}]
858ca054eeeSaravinth0510
859ca054eeeSaravinth0510    Sleep  ${NETWORK_TIMEOUT}s
860ca054eeeSaravinth0510    Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT}
861