xref: /openbmc/openbmc-test-automation/openpower/ext_interfaces/test_vmi_multiple_interfaces.robot (revision 6fb70d98f2f1cb9273ba912deaa2cebe3c23ea86)
14f0bcbeaSshrsuman123*** Settings ***
24f0bcbeaSshrsuman123
34f0bcbeaSshrsuman123Documentation    VMI multiple network interface tests.
44f0bcbeaSshrsuman123
54f0bcbeaSshrsuman123# This includes test scenarios where VMI has multiple interfaces.
64f0bcbeaSshrsuman123# So,assigns and verifies the combination of network mode in interfaces.
74f0bcbeaSshrsuman123
84f0bcbeaSshrsuman123Resource         ../../lib/external_intf/vmi_utils.robot
94f0bcbeaSshrsuman123
104f0bcbeaSshrsuman123Suite Setup       Suite Setup Execution
114e0978d9SGeorge KeishingSuite Teardown    Run Keyword And Ignore Error  Suite Teardown Execution
124f0bcbeaSshrsuman123
13*6fb70d98SMatt FischerTest Tags        Vmi_Multiple_Interfaces
14725e066bSGeorge Keishing
154f0bcbeaSshrsuman123*** Variables ***
164f0bcbeaSshrsuman123
174f0bcbeaSshrsuman123${test_ipv4_1}              10.6.6.6
184f0bcbeaSshrsuman123${test_gateway_1}           10.6.6.1
194f0bcbeaSshrsuman123${test_netmask_1}           255.255.252.0
204f0bcbeaSshrsuman123
214f0bcbeaSshrsuman123${test_ipv4_2}              10.5.20.5
224f0bcbeaSshrsuman123${test_gateway_2}           10.5.20.1
234f0bcbeaSshrsuman123${test_netmask_2}           255.255.255.0
244f0bcbeaSshrsuman123${test_ipv4_3}              10.6.4.6
254f0bcbeaSshrsuman123
264f0bcbeaSshrsuman123*** Test Cases ***
274f0bcbeaSshrsuman123
284f0bcbeaSshrsuman123Configure VMI Both Interfaces In Same Subnet And Verify
294f0bcbeaSshrsuman123    [Documentation]  Configure VMI both interfaces in same subnet and verify.
304f0bcbeaSshrsuman123    [Tags]  Configure_VMI_Both_Interfaces_In_Same_Subnet_And_Verify
314f0bcbeaSshrsuman123    [Teardown]  Test Teardown Execution
324f0bcbeaSshrsuman123
334f0bcbeaSshrsuman123    Set Static IPv4 Address To VMI And Verify  ${test_ipv4_1}  ${test_gateway_1}
344f0bcbeaSshrsuman123    ...  ${test_netmask_1}
354f0bcbeaSshrsuman123    Set Static IPv4 Address To VMI And Verify  ${test_ipv4_3}  ${test_gateway_1}
364f0bcbeaSshrsuman123    ...  ${test_netmask_1}  ${HTTP_ACCEPTED}  ${interface_list}[1]
374f0bcbeaSshrsuman123
384f0bcbeaSshrsuman123Configure VMI Both Interfaces In Different Subnet And Verify
394f0bcbeaSshrsuman123    [Documentation]  Configure VMI both interfaces in different subnet and verify.
404f0bcbeaSshrsuman123    [Tags]  Configure_VMI_Both_Interfaces_In_Different_Subnet_And_Verify
414f0bcbeaSshrsuman123    [Teardown]  Test Teardown Execution
424f0bcbeaSshrsuman123
434f0bcbeaSshrsuman123    Set Static IPv4 Address To VMI And Verify  ${test_ipv4_1}  ${test_gateway_1}
444f0bcbeaSshrsuman123    ...  ${test_netmask_1}
454f0bcbeaSshrsuman123    Set Static IPv4 Address To VMI And Verify  ${test_ipv4_2}  ${test_gateway_2}
464f0bcbeaSshrsuman123    ...  ${test_netmask_2}  ${HTTP_ACCEPTED}  ${interface_list}[1]
474f0bcbeaSshrsuman123
48445eccc1Sshrsuman123Configure VMI Both Interfaces In Dynamic And Verify
49445eccc1Sshrsuman123    [Documentation]  Configure VMI both interfaces in dynamic And Verify.
50445eccc1Sshrsuman123    [Tags]  Configure_VMI_Both_Interfaces_In_Dynamic_And_Verify
51445eccc1Sshrsuman123    [Teardown]   Run keywords  Set VMI IPv4 Origin  ${False}
52445eccc1Sshrsuman123    ...  AND  Set VMI IPv4 Origin  ${False}  ${HTTP_ACCEPTED}  ${interface_list}[1]
530f15125bSMegha G N    ...  AND  Test Teardown Execution
54445eccc1Sshrsuman123
55445eccc1Sshrsuman123    Set VMI IPv4 Origin  ${True}
56445eccc1Sshrsuman123    ${default}=  Set Variable  0.0.0.0
57445eccc1Sshrsuman123    Set VMI IPv4 Origin  ${True}  ${HTTP_ACCEPTED}  ${interface_list}[1]
58445eccc1Sshrsuman123    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
59445eccc1Sshrsuman123    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}  ${interface_list}[1]
60445eccc1Sshrsuman123
617e9b2127Sshrsuman123Configure VMI First Interface In Static And Second In Dynamic And Verify
627e9b2127Sshrsuman123    [Documentation]  Configure VMI first interface in static mode and second interface in dynamic mode
637e9b2127Sshrsuman123    ...  and verify first gets static ip details and second gets dynamic ip details.
647e9b2127Sshrsuman123    [Tags]  Configure_VMI_First_Interface_In_Static_And_Second_In_Dynamic_And_Verify
657e9b2127Sshrsuman123    [Teardown]   Run keywords  Delete VMI IPv4 Address  AND
667e9b2127Sshrsuman123    ...  Set VMI IPv4 Origin  ${False}  ${HTTP_ACCEPTED}  ${interface_list}[1]
670f15125bSMegha G N    ...  AND  Test Teardown Execution
687e9b2127Sshrsuman123
697e9b2127Sshrsuman123    Set Static IPv4 Address To VMI And Verify  ${test_ipv4_1}  ${test_gateway_1}
707e9b2127Sshrsuman123    ...  ${test_netmask_1}
717e9b2127Sshrsuman123    Set VMI IPv4 Origin  ${True}  ${HTTP_ACCEPTED}  ${interface_list}[1]
727e9b2127Sshrsuman123    ${default}=  Set Variable  0.0.0.0
737e9b2127Sshrsuman123    Verify VMI Network Interface Details  ${test_ipv4_1}  Static  ${test_gateway_1}  ${test_netmask_1}
747e9b2127Sshrsuman123    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}  ${interface_list}[1]
757e9b2127Sshrsuman123
767e9b2127Sshrsuman123Configure VMI First Interface In Dynamic And Second In Static And Verify
777e9b2127Sshrsuman123    [Documentation]  Configure VMI first interface in dynamic mode and second interface in static mode
787e9b2127Sshrsuman123    ...  and verify first gets dynamic ip details and second gets static ip details.
797e9b2127Sshrsuman123    [Tags]  Configure_VMI_First_Interface_In_Dynamic_And_Second_In_Static_And_Verify
807e9b2127Sshrsuman123    [Teardown]   Run keywords  Set VMI IPv4 Origin  ${False}  AND
817e9b2127Sshrsuman123    ...  Delete VMI IPv4 Address  IPv4StaticAddresses  ${HTTP_ACCEPTED}  ${interface_list}[1]
820f15125bSMegha G N    ...  AND  Test Teardown Execution
837e9b2127Sshrsuman123
847e9b2127Sshrsuman123    Set VMI IPv4 Origin  ${True}
857e9b2127Sshrsuman123    ${default}=  Set Variable  0.0.0.0
867e9b2127Sshrsuman123    Set Static IPv4 Address To VMI And Verify  ${test_ipv4_1}  ${test_gateway_1}
877e9b2127Sshrsuman123    ...  ${test_netmask_1}  ${HTTP_ACCEPTED}  ${interface_list}[1]
887e9b2127Sshrsuman123    Verify VMI Network Interface Details  ${default}  DHCP  ${default}  ${default}
897e9b2127Sshrsuman123
904f0bcbeaSshrsuman123*** Keywords ***
914f0bcbeaSshrsuman123
924f0bcbeaSshrsuman123Suite Setup Execution
934f0bcbeaSshrsuman123    [Documentation]  Do suite setup execution task.
944f0bcbeaSshrsuman123
954f0bcbeaSshrsuman123    Redfish.Login
964f0bcbeaSshrsuman123    Redfish Power On  stack_mode=skip  quiet=1
974f0bcbeaSshrsuman123    Get Original Vmi Details
984f0bcbeaSshrsuman123
994f0bcbeaSshrsuman123
1004f0bcbeaSshrsuman123Test Teardown Execution
1014f0bcbeaSshrsuman123    [Documentation]  Do test teardown execution task.
1024f0bcbeaSshrsuman123
1034f0bcbeaSshrsuman123    FOR  ${interface}  IN   @{interface_list}
1044f0bcbeaSshrsuman123        Delete VMI IPv4 Address  IPv4StaticAddresses  ${HTTP_ACCEPTED}  ${interface}
1054f0bcbeaSshrsuman123    END
1064f0bcbeaSshrsuman123
1074f0bcbeaSshrsuman123    FFDC On Test Case Fail
1084f0bcbeaSshrsuman123
1094f0bcbeaSshrsuman123
1104f0bcbeaSshrsuman123Get Original Vmi Details
1114f0bcbeaSshrsuman123    [Documentation]  Get original details of VMI.
1124f0bcbeaSshrsuman123
1134f0bcbeaSshrsuman123    @{interface_list}=  Get VMI Interfaces
1144f0bcbeaSshrsuman123    Set Suite Variable  @{interface_list}
1154f0bcbeaSshrsuman123
1164f0bcbeaSshrsuman123    FOR  ${interface}  IN   @{interface_list}
1174f0bcbeaSshrsuman123        ${resp}=  Redfish.Get
1184f0bcbeaSshrsuman123        ...  /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface}
1194f0bcbeaSshrsuman123        ${ip_resp}=  Evaluate  json.loads(r'''${resp.text}''')  json
1204f0bcbeaSshrsuman123        ${length}=  Get Length  ${ip_resp["IPv4StaticAddresses"]}
1214f0bcbeaSshrsuman123        ${vmi_network_conf}=  Catenate  SEPARATOR=_   vmi_network_conf  ${interface}
1224f0bcbeaSshrsuman123        ${vmi_network_conf_value}=  Run Keyword If  ${length} != ${0}
1234f0bcbeaSshrsuman123        ...  Get VMI Network Interface Details  ${interface}
1244f0bcbeaSshrsuman123        Set Suite Variable  ${${vmi_network_conf}}  ${vmi_network_conf_value}
1254f0bcbeaSshrsuman123    END
1264f0bcbeaSshrsuman123
1274f0bcbeaSshrsuman123
1284f0bcbeaSshrsuman123Suite Teardown Execution
1294f0bcbeaSshrsuman123    [Documentation]  Do suite teardown execution task
1304f0bcbeaSshrsuman123    ...  Set original vmi details and verify.
1314f0bcbeaSshrsuman123
1324f0bcbeaSshrsuman123    FOR  ${interface}  IN   @{interface_list}
1334f0bcbeaSshrsuman123        Run Keyword If  ${vmi_network_conf_${interface}} != ${None}
1344f0bcbeaSshrsuman123        ...  Set Static IPv4 Address To VMI And Verify
1354f0bcbeaSshrsuman123        ...  ${vmi_network_conf_${interface}}[IPv4_Address]
1364f0bcbeaSshrsuman123        ...  ${vmi_network_conf_${interface}}[IPv4_Gateway]
1374f0bcbeaSshrsuman123        ...  ${vmi_network_conf_${interface}}[IPv4_SubnetMask]
1384f0bcbeaSshrsuman123        ...  ${HTTP_ACCEPTED}  ${interface}
1394f0bcbeaSshrsuman123    END
1404f0bcbeaSshrsuman123
1414f0bcbeaSshrsuman123    Redfish.Logout
1424f0bcbeaSshrsuman123
143