1*** Settings ***
2Documentation    Module to test network stability.
3...              By default running HTX mdt.bu profile for stress test.
4
5Resource         ../lib/os_utilities.robot
6Library          ../lib/os_utils_keywords.py
7
8Test Setup      Test Setup Execution
9Test Teardown   Test Teardown Execution
10
11Force Tags      Network_Stability
12
13*** Variables ****
14
15${stack_mode}        skip
16
17*** Test Cases ***
18
19Network Stability Test
20    [Documentation]  Execute network stress in loop.
21    [Tags]  Network_Stability_Test
22
23    # Run the network stress test HTX_LOOP times in loop.
24    Repeat Keyword  ${HTX_LOOP} times  Execute Network Test
25
26
27*** Keywords ***
28
29Execute Network Test
30    [Documentation]  Execute network stress test.
31    # Test Flow:
32    #              - Power on
33    #              - Establish SSH connection session
34    #              - Create HTX mdt profile
35    #              - Run HTX exerciser
36    #              - Inject network activity on BMC
37    #              - Check HTX status for errors
38    #              - Shutdown HTX if no error when timer expires
39
40    REST Power On  stack_mode=skip
41
42    # Post Power off and on, the OS SSH session needs to be established.
43    Login To OS
44
45    Run Keyword If  '${HTX_MDT_PROFILE}' == 'mdt.bu'
46    ...  Create Default MDT Profile
47
48    Run MDT Profile
49
50    # HTX is running, inject network traffic and check every HTX_INTERVAL
51    ${status}=  Run Until Keyword Fails  ${HTX_DURATION}  ${HTX_INTERVAL}
52    ...  Start Network Test
53
54    Run Keyword If  '${status}' == 'False'
55    ...  Fail  Network is unstable. Please check for errors.
56
57    Shutdown HTX Exerciser
58
59    Print Timen  HTX Test ran for: ${HTX_DURATION}
60
61
62Start Network Test
63    [Documentation]  Start network stress test.
64    BMC Network Payload
65    Check HTX Run Status
66
67
68BMC Network Payload
69    [Documentation]  Start creating network activity over BMC network.
70
71    # REST GET enumerate call.
72    OpenBMC Get Request
73    ...  /xyz/openbmc_project/inventory/enumerate  timeout=${20}  quiet=${1}
74
75    # Upload 32 MB data via REST to BMC.
76    REST Upload File To BMC
77
78
79Test Setup Execution
80    [Documentation]  Do the initial test setup.
81
82    REST Power On  stack_mode=skip
83    Delete All Error Logs
84    Tool Exist  htxcmdline
85
86    # Shutdown if HTX is running.
87    ${status}=  Is HTX Running
88    Run Keyword If  '${status}' == 'True'
89    ...  Shutdown HTX Exerciser
90
91
92Test Teardown Execution
93    [Documentation]  Do the post test teardown.
94    # 1. Shut down HTX exerciser if test Failed.
95    # 2. Capture FFDC on test failure.
96    # 3. Close all open SSH connections.
97
98    # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
99    Run Keyword If  '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
100    ...  Shutdown HTX Exerciser
101
102    FFDC On Test Case Fail
103    Close All Connections
104