Tidy up merged Robot files.
[integration/test.git] / csit / suites / lacp / Lacp_Feature_OF13 / 020__lacp_lag_resiliency.robot
1 *** Settings ***
2 Documentation     Test suite for LACP Link Resiliency
3 Suite Setup       LACP Inventory Suite Setup
4 Suite Teardown    Delete All Sessions
5 Library           SSHLibrary
6 Library           Collections
7 Library           String
8 Library           RequestsLibrary
9 Library           ../../../libraries/Common.py
10 Resource          ../../../libraries/Utils.robot
11 Variables         ../../../variables/Variables.py
12
13 *** Variables ***
14 ${node1}          openflow:1
15 ${agg-id1}        1
16 ${agg-id2}        2
17 ${agg1-connector-id1}    1
18 ${agg1-connector-id2}    2
19 ${agg2-connector-id1}    3
20 ${agg2-connector-id2}    4
21
22 *** Test Cases ***
23 Verify the Group tables data for Switch(S1)
24     [Documentation]    Functionality would check the presence of group tables entries on OVS Switch(S1) initially
25     Verify Switch S1 Group Table    select    1    2    up
26     Verify Switch S1 Group Table    select    3    4    up
27
28 Generate port down scenario of one of the LAG interface on the Host H2 side and check functionality
29     [Documentation]    Generate the link failure on Host H2 LAG Membership-port and verify functionality
30     Set Host interface state    h2-eth1    down
31
32 Verify information of lacp-aggregator associated with Host H2 after link down scenario
33     [Documentation]    Get lacp-aggregator data for node associated with Host H2
34     Wait Until Keyword Succeeds    15s    1s    Verify LACP aggregator data is updated post link down scenario
35
36 Verify the Switch(S1) Group tables data after H2 link down scenario
37     [Documentation]    Functionality to check if the corresponding group entries are updated on OVS Switch(S1) after port-down scenario on the Host H2
38     Verify Switch S1 Group Table    select    3    4    down
39
40 Generate port up scenario of the LAG interface on the Host H2 side and check functionality
41     [Documentation]    Generate the link up scenario on Host H2 LAG Membership-port and verify functionality
42     Set Host interface state    h2-eth1    up
43
44 Verify information of lacp-aggregator associated with Host H2 after link up scenario
45     [Documentation]    Get lacp-aggregator data for node associated with Host H2
46     Wait Until Keyword Succeeds    15s    1s    Verify LACP aggregator data is updated post link up scenario
47
48 Verify Switch(S1) Flow and Group tables data after H2 link up scenario
49     [Documentation]    Functionality to check if the corresponding group entries are updated on OVS Switch(S1) after port-bringup scenario on the Host H2
50     Verify Switch S1 Group Table    select    3    4    up
51
52 *** Keywords ***
53 Verify LACP RESTAPI Response Code for node
54     [Documentation]    Will check for the response code of the REST query
55     Should Be Equal As Strings    ${resp.status_code}    200
56     Should Contain    ${resp.content}    ${node1}
57
58 Verify LACP RESTAPI Aggregator and Tag Contents
59     [Arguments]    ${resp.content}    ${content-lookup}
60     [Documentation]    Will check for the LACP Specific tags or Aggregator ID for node
61     Should Contain    ${resp.content}    ${content-lookup}
62
63 Verify LACP RESTAPI connector associated for aggregator
64     [Arguments]    ${resp.content}    ${node}    ${agg-connector-id}
65     [Documentation]    Will check for the LACP connector info for each aggregator
66     Should Contain    ${resp.content}    ${node}:${agg-connector-id}
67
68 Verify LACP aggregator data is updated post link down scenario
69     [Documentation]    Functionality will verify the node conenctor data on the lacp-agg api after link down scenario
70     ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL_NODES_API}/node/${node1}/lacp-aggregators/${agg-id2}
71     Verify LACP RESTAPI Response Code for node
72     Verify LACP RESTAPI connector associated for aggregator    ${resp.content}    ${node1}    ${agg2-connector-id1}
73     Should not Contain    ${resp.content}    ${node1}:${agg2-connector-id2}
74     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lag-groupid
75
76 Verify LACP aggregator data is updated post link up scenario
77     [Documentation]    Functionality will verify the node connector data on the lacp-agg api after link up scenario
78     ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL_NODES_API}/node/${node1}/lacp-aggregators/${agg-id2}
79     Verify LACP RESTAPI Response Code for node
80     Verify LACP RESTAPI connector associated for aggregator    ${resp.content}    ${node1}    ${agg2-connector-id1}
81     Verify LACP RESTAPI connector associated for aggregator    ${resp.content}    ${node1}    ${agg2-connector-id2}
82     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lag-groupid
83
84 Verify LACP Tags Are Formed
85     [Documentation]    Fundamental Check That LACP is working
86     ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL_NODES_API}
87     Verify LACP RESTAPI Response Code for node
88     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    non-lag-groupid
89     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lacp-aggregators
90
91 LACP Inventory Suite Setup
92     [Documentation]    If these basic checks fail, there is no need to continue any of the other test cases
93     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
94     Wait Until Keyword Succeeds    15s    1s    Verify LACP Tags Are Formed
95
96 Set Host interface state
97     [Arguments]    ${port-id}    ${port-state}
98     [Documentation]    Will configure the port state of the Host to either up or down
99     Open Connection    ${MININET}    prompt=${DEFAULT_LINUX_PROMPT}
100     Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
101     Execute Command    sudo ./m h2
102     Execute Command    sudo ifconfig ${port-id} ${port-state}
103     Execute Command    sudo ifconfig ${port-id}
104
105 Verify Switch S1 Group Table
106     [Arguments]    ${group-type}    ${port-id1}    ${port-id2}    ${port-id2-state}
107     [Documentation]    Functionality to verify the presence of LACP group entries on the OVS Switch(S1) Group table
108     ${group_output}=    Run Command on Remote System    ${MININET}    sudo ovs-ofctl dump-groups s1 -O OpenFlow13    ${MININET_USER}    #
109     Log    ${group_output}
110     Comment    ${group_output}    Read Until    mininet>
111     ${result}=    Get Lines Containing String    ${group_output}    output:${port-id1}
112     Should Contain    ${result}    type=${group-type}
113     Should Contain    ${result}    output:${port-id1}
114     Run Keyword If    "${port-id2-state}" == "up"    Should Contain    ${result}    output:${port-id2}    ELSE    Should not Contain
115     ...    ${result}    output:${port-id2}