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