shrsuman123 | 4f0bcbe | 2021-08-31 04:05:57 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation VMI multiple network interface tests. |
| 4 | |
| 5 | # This includes test scenarios where VMI has multiple interfaces. |
| 6 | # So,assigns and verifies the combination of network mode in interfaces. |
| 7 | |
| 8 | Resource ../../lib/external_intf/vmi_utils.robot |
| 9 | |
| 10 | Suite Setup Suite Setup Execution |
| 11 | Test Teardown FFDC On Test Case Fail |
| 12 | Suite Teardown Suite Teardown Execution |
| 13 | |
| 14 | *** Variables *** |
| 15 | |
| 16 | ${test_ipv4_1} 10.6.6.6 |
| 17 | ${test_gateway_1} 10.6.6.1 |
| 18 | ${test_netmask_1} 255.255.252.0 |
| 19 | |
| 20 | ${test_ipv4_2} 10.5.20.5 |
| 21 | ${test_gateway_2} 10.5.20.1 |
| 22 | ${test_netmask_2} 255.255.255.0 |
| 23 | ${test_ipv4_3} 10.6.4.6 |
| 24 | |
| 25 | *** Test Cases *** |
| 26 | |
| 27 | Configure VMI Both Interfaces In Same Subnet And Verify |
| 28 | [Documentation] Configure VMI both interfaces in same subnet and verify. |
| 29 | [Tags] Configure_VMI_Both_Interfaces_In_Same_Subnet_And_Verify |
| 30 | [Teardown] Test Teardown Execution |
| 31 | |
| 32 | Set Static IPv4 Address To VMI And Verify ${test_ipv4_1} ${test_gateway_1} |
| 33 | ... ${test_netmask_1} |
| 34 | Set Static IPv4 Address To VMI And Verify ${test_ipv4_3} ${test_gateway_1} |
| 35 | ... ${test_netmask_1} ${HTTP_ACCEPTED} ${interface_list}[1] |
| 36 | |
| 37 | Configure VMI Both Interfaces In Different Subnet And Verify |
| 38 | [Documentation] Configure VMI both interfaces in different subnet and verify. |
| 39 | [Tags] Configure_VMI_Both_Interfaces_In_Different_Subnet_And_Verify |
| 40 | [Teardown] Test Teardown Execution |
| 41 | |
| 42 | Set Static IPv4 Address To VMI And Verify ${test_ipv4_1} ${test_gateway_1} |
| 43 | ... ${test_netmask_1} |
| 44 | Set Static IPv4 Address To VMI And Verify ${test_ipv4_2} ${test_gateway_2} |
| 45 | ... ${test_netmask_2} ${HTTP_ACCEPTED} ${interface_list}[1] |
| 46 | |
| 47 | *** Keywords *** |
| 48 | |
| 49 | Suite Setup Execution |
| 50 | [Documentation] Do suite setup execution task. |
| 51 | |
| 52 | Redfish.Login |
| 53 | Redfish Power On stack_mode=skip quiet=1 |
| 54 | Get Original Vmi Details |
| 55 | |
| 56 | |
| 57 | Test Teardown Execution |
| 58 | [Documentation] Do test teardown execution task. |
| 59 | |
| 60 | FOR ${interface} IN @{interface_list} |
| 61 | Delete VMI IPv4 Address IPv4StaticAddresses ${HTTP_ACCEPTED} ${interface} |
| 62 | END |
| 63 | |
| 64 | FFDC On Test Case Fail |
| 65 | |
| 66 | |
| 67 | Get Original Vmi Details |
| 68 | [Documentation] Get original details of VMI. |
| 69 | |
| 70 | @{interface_list}= Get VMI Interfaces |
| 71 | Set Suite Variable @{interface_list} |
| 72 | |
| 73 | FOR ${interface} IN @{interface_list} |
| 74 | ${resp}= Redfish.Get |
| 75 | ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} |
| 76 | ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json |
| 77 | ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]} |
| 78 | ${vmi_network_conf}= Catenate SEPARATOR=_ vmi_network_conf ${interface} |
| 79 | ${vmi_network_conf_value}= Run Keyword If ${length} != ${0} |
| 80 | ... Get VMI Network Interface Details ${interface} |
| 81 | Set Suite Variable ${${vmi_network_conf}} ${vmi_network_conf_value} |
| 82 | END |
| 83 | |
| 84 | |
| 85 | Suite Teardown Execution |
| 86 | [Documentation] Do suite teardown execution task |
| 87 | ... Set original vmi details and verify. |
| 88 | |
| 89 | FOR ${interface} IN @{interface_list} |
| 90 | Run Keyword If ${vmi_network_conf_${interface}} != ${None} |
| 91 | ... Set Static IPv4 Address To VMI And Verify |
| 92 | ... ${vmi_network_conf_${interface}}[IPv4_Address] |
| 93 | ... ${vmi_network_conf_${interface}}[IPv4_Gateway] |
| 94 | ... ${vmi_network_conf_${interface}}[IPv4_SubnetMask] |
| 95 | ... ${HTTP_ACCEPTED} ${interface} |
| 96 | END |
| 97 | |
| 98 | Redfish.Logout |
| 99 | |