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