2f4f289daf92fe0a56cb002882fd331785c41896
[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     [Arguments]    ${resp}
55     [Documentation]    Will check for the response code of the REST query
56     Should Be Equal As Strings    ${resp.status_code}    200
57     Should Contain    ${resp.content}    ${node1}
58
59 Verify LACP RESTAPI Aggregator and Tag Contents
60     [Arguments]    ${resp.content}    ${content-lookup}
61     [Documentation]    Will check for the LACP Specific tags or Aggregator ID for node
62     Should Contain    ${resp.content}    ${content-lookup}
63
64 Verify LACP RESTAPI connector associated for aggregator
65     [Arguments]    ${resp.content}    ${node}    ${agg-connector-id}
66     [Documentation]    Will check for the LACP connector info for each aggregator
67     Should Contain    ${resp.content}    ${node}:${agg-connector-id}
68
69 Verify LACP aggregator data is updated post link down scenario
70     [Documentation]    Functionality will verify the node conenctor data on the lacp-agg api after link down scenario
71     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_NODES_API}/node/${node1}/lacp-aggregators/${agg-id2}
72     Verify LACP RESTAPI Response Code for node    ${resp}
73     Verify LACP RESTAPI connector associated for aggregator    ${resp.content}    ${node1}    ${agg2-connector-id1}
74     Should not Contain    ${resp.content}    ${node1}:${agg2-connector-id2}
75     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lag-groupid
76
77 Verify LACP aggregator data is updated post link up scenario
78     [Documentation]    Functionality will verify the node connector data on the lacp-agg api after link up scenario
79     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_NODES_API}/node/${node1}/lacp-aggregators/${agg-id2}
80     Verify LACP RESTAPI Response Code for node    ${resp}
81     Verify LACP RESTAPI connector associated for aggregator    ${resp.content}    ${node1}    ${agg2-connector-id1}
82     Verify LACP RESTAPI connector associated for aggregator    ${resp.content}    ${node1}    ${agg2-connector-id2}
83     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lag-groupid
84
85 Verify LACP Tags Are Formed
86     [Documentation]    Fundamental Check That LACP is working
87     ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_NODES_API}
88     Verify LACP RESTAPI Response Code for node    ${resp}
89     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    non-lag-groupid
90     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lacp-aggregators
91
92 LACP Inventory Suite Setup
93     [Documentation]    If these basic checks fail, there is no need to continue any of the other test cases
94     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
95     Wait Until Keyword Succeeds    15s    1s    Verify LACP Tags Are Formed
96
97 Set Host interface state
98     [Arguments]    ${port-id}    ${port-state}
99     [Documentation]    Will configure the port state of the Host to either up or down
100     Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}
101     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
102     Write    sudo ./m h2
103     Write    sudo ifconfig ${port-id}
104     Write    sudo ifconfig ${port-id} ${port-state}
105
106 Verify Switch S1 Group Table
107     [Arguments]    ${group-type}    ${port-id1}    ${port-id2}    ${port-id2-state}
108     [Documentation]    Functionality to verify the presence of LACP group entries on the OVS Switch(S1) Group table
109     ${group_output}=    Run Command on Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-ofctl dump-groups s1 -O OpenFlow13    ${TOOLS_SYSTEM_USER}    #
110     Log    ${group_output}
111     Comment    ${group_output}    Read Until    mininet>
112     ${result}=    Get Lines Containing String    ${group_output}    output:${port-id1}
113     Should Contain    ${result}    type=${group-type}
114     Should Contain    ${result}    output:${port-id1}
115     Run Keyword If    "${port-id2-state}" == "up"    Should Contain    ${result}    output:${port-id2}
116     ...    ELSE    Should not Contain    ${result}    output:${port-id2}