Replace Bierman02 with RFC8040 for OpenFlow Plugin
[integration/test.git] / csit / suites / l2switch / Loop_Removal_OF13 / 010__loop_of_3.robot
1 *** Settings ***
2 Documentation     Test suite for Ring/Loop topology of size 3
3 Suite Setup       Start Suite
4 Suite Teardown    Utils.Stop Mininet
5 Library           RequestsLibrary
6 Resource          ../../../libraries/Utils.robot
7 Resource          ../../../variables/openflowplugin/Variables.robot
8 Variables         ../../../variables/Variables.py
9
10 *** Variables ***
11 ${FORWARD}        "stp-status-aware-node-connector:status":"forwarding"
12 ${DISCARD}        "stp-status-aware-node-connector:status":"discarding"
13
14 *** Test Cases ***
15 Check Stats for node 1
16     [Documentation]    Get the stats for a node
17     Wait Until Keyword Succeeds    10s    2s    Check Nodes Stats    openflow%3A1
18
19 Check Stats for node 2
20     [Documentation]    Get the stats for a node
21     Wait Until Keyword Succeeds    10s    2s    Check Nodes Stats    openflow%3A2
22
23 Check Stats for node 3
24     [Documentation]    Get the stats for a node
25     Wait Until Keyword Succeeds    10s    2s    Check Nodes Stats    openflow%3A3
26
27 Check Ports
28     [Documentation]    Check all ports are present
29     @{list}    Create List    openflow:1:1    openflow:1:2    openflow:1:3    openflow:2:1    openflow:2:2
30     ...    openflow:2:3    openflow:3:1    openflow:3:2    openflow:3:3
31     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${RFC8040_OPERATIONAL_NODES_API}    ${list}
32
33 Check Ports STP status
34     [Documentation]    Check the stp status of the ports (forwarding/discarding)
35     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${RFC8040_OPERATIONAL_NODES_API}    ${FORWARD}    4
36     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${RFC8040_OPERATIONAL_NODES_API}    ${DISCARD}    2
37
38 Check Flows
39     [Documentation]    Check all flows are present
40     [Tags]    bug 6984    bug
41     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${RFC8040_OPERATIONAL_NODES_API}    "output-node-connector"    16
42     [Teardown]    Report_Failure_Due_To_Bug    6984
43
44 Ping Test
45     [Documentation]    Ping h1 to h2, verify no packet loss or duplicates
46     Wait Until Keyword Succeeds    10s    2s    Ping Works Good
47
48 Link Down
49     [Documentation]    Take link s1-s2 down and verify ping works. This is not implemented.
50     [Tags]    exclude
51     Write    link s1 s2 down
52     Read Until    mininet>
53     @{list}    Create List    ${DISCARD}
54     Wait Until Keyword Succeeds    10s    2s    Check For Elements Not At URI    ${RFC8040_OPERATIONAL_NODES_API}    ${list}
55     Wait Until Keyword Succeeds    10s    2s    Ping Works Good
56
57 Link Up
58     [Documentation]    Take link s1-s2 up and verify ping works. This is not implemented.
59     [Tags]    exclude
60     Write    link s1 s2 up
61     Read Until    mininet>
62     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${RFC8040_OPERATIONAL_NODES_API}    ${FORWARD}    4
63     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${RFC8040_OPERATIONAL_NODES_API}    ${DISCARD}    2
64     # This sleep is needed because if the ping in the below WUKS is launched before the STP effectively removes the link,
65     # it produces a packet storm in mininet that makes the test unresponsive.
66     Sleep    1
67     Wait Until Keyword Succeeds    10s    2s    Ping Works Good
68
69 Remove Port
70     [Documentation]    Remove port s1-eth2 and verify ping works. This is not stable, should be rewritten to pick a port that is not blocked.
71     [Tags]    exclude
72     Write    sh ovs-vsctl del-port s1 s1-eth2
73     Read Until    mininet>
74     Wait Until Keyword Succeeds    10s    2s    Ping Works Good
75
76 Add Port
77     [Documentation]    Add port s1-eth2 and verify ping works. This is not stable, should be rewritten to pick a port that is not blocked.
78     [Tags]    exclude
79     Write    sh ovs-vsctl add-port s1 s1-eth2 -- set interface s1-eth2 ofport=2
80     Read Until    mininet>
81     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${RFC8040_OPERATIONAL_NODES_API}    ${FORWARD}    4
82     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${RFC8040_OPERATIONAL_NODES_API}    ${DISCARD}    2
83     # This sleep is needed because if the ping in the below WUKS is launched before the STP effectively removes the link,
84     # it produces a packet storm in mininet that makes the test unresponsive.
85     Sleep    1
86     Wait Until Keyword Succeeds    10s    2s    Ping Works Good
87
88 *** Keywords ***
89 Start Suite
90     [Documentation]    Open controller session & mininet connection and start mininet custom topo
91     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
92     ${start}=    Set Variable    sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --custom customtopo.py --topo ring --switch ovsk,protocols=OpenFlow13
93     ${mininet_conn_id}=    Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
94     Set Suite Variable    ${mininet_conn_id}
95     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
96     Put File    ${CURDIR}/../topologies/customtopo.py
97     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
98     Execute Command    sudo mn -c
99     Write    ${start}
100     Read Until    mininet>
101
102 Ping Works Good
103     Write    h1 ping -w 1 h2
104     ${result}    Read Until    mininet>
105     Should Contain    ${result}    received, 0% packet loss
106     Should Not Contain    ${result}    duplicates