Step 1: Move vm scripts to the right place
[integration/test.git] / test / 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 Suite
5 Library           RequestsLibrary
6 Resource          ../../../libraries/Utils.robot
7 Variables         ../../../variables/Variables.py
8
9 *** Variables ***
10 ${FORWARD}        "stp-status-aware-node-connector:status":"forwarding"
11 ${DISCARD}        "stp-status-aware-node-connector:status":"discarding"
12
13 *** Test Cases ***
14 Check Stats for node 1
15     [Documentation]    Get the stats for a node
16     Wait Until Keyword Succeeds    10s    2s    Check Nodes Stats    openflow:1
17
18 Check Stats for node 2
19     [Documentation]    Get the stats for a node
20     Wait Until Keyword Succeeds    10s    2s    Check Nodes Stats    openflow:2
21
22 Check Stats for node 3
23     [Documentation]    Get the stats for a node
24     Wait Until Keyword Succeeds    10s    2s    Check Nodes Stats    openflow:3
25
26 Check Ports
27     [Documentation]    Check all ports are present
28     @{list}    Create List    openflow:1:1    openflow:1:2    openflow:1:3    openflow:2:1    openflow:2:2
29     ...    openflow:2:3    openflow:3:1    openflow:3:2    openflow:3:3
30     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}    ${list}
31
32 Check Ports STP status
33     [Documentation]    Check the stp status of the ports (forwarding/discarding)
34     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${OPERATIONAL_NODES_API}    ${FORWARD}    4
35     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${OPERATIONAL_NODES_API}    ${DISCARD}    2
36
37 Ping Test
38     [Documentation]    Ping h1 to h2, verify no packet loss or duplicates
39     Write    h1 ping -w 1 h2
40     ${result}    Read Until    mininet>
41     Should Contain    ${result}    1 received, 0% packet loss
42     Should Not Contain    ${result}    duplicates
43
44 Link Down
45     [Documentation]    Take link s1-s2 down and verify ping works
46     Write    link s1 s2 down
47     Read Until    mininet>
48     @{list}    Create List    ${DISCARD}
49     Wait Until Keyword Succeeds    10s    2s    Check For Elements Not At URI    ${OPERATIONAL_NODES_API}    ${list}
50     Write    h1 ping -w 1 h2
51     ${result}    Read Until    mininet>
52     Should Contain    ${result}    received, 0% packet loss
53     Should Not Contain    ${result}    duplicates
54
55 Link Up
56     [Documentation]    Take link s1-s2 up and verify ping works
57     Write    link s1 s2 up
58     Read Until    mininet>
59     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${OPERATIONAL_NODES_API}    ${FORWARD}    4
60     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${OPERATIONAL_NODES_API}    ${DISCARD}    2
61     Write    h1 ping -w 1 h2
62     ${result}    Read Until    mininet>
63     Should Contain    ${result}    received, 0% packet loss
64     Should Not Contain    ${result}    duplicates
65
66 Remove Port
67     [Documentation]    Remove port s1-eth2 and verify ping works
68     Write    sh ovs-vsctl del-port s1 s1-eth2
69     Read Until    mininet>
70     @{list}    Create List    ${DISCARD}
71     Wait Until Keyword Succeeds    10s    2s    Check For Elements Not At URI    ${OPERATIONAL_NODES_API}    ${list}
72     Write    h1 ping -w 1 h2
73     ${result}    Read Until    mininet>
74     Should Contain    ${result}    received, 0% packet loss
75     Should Not Contain    ${result}    duplicates
76
77 Add Port
78     [Documentation]    Add port s1-eth2 and verify ping works
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    ${OPERATIONAL_NODES_API}    ${FORWARD}    4
82     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${OPERATIONAL_NODES_API}    ${DISCARD}    2
83     Sleep    1
84     Write    h1 ping -w 1 h2
85     ${result}    Read Until    mininet>
86     Should Contain    ${result}    received, 0% packet loss
87     Should Not Contain    ${result}    duplicates
88
89 *** Keywords ***
90 Start Suite
91     [Documentation]    Open controller session & mininet connection and start mininet custom topo
92     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
93     ${start}=    Set Variable    sudo mn --controller=remote,ip=${CONTROLLER} --custom customtopo.py --topo ring --switch ovsk,protocols=OpenFlow13
94     ${mininet_conn_id}=    Open Connection    ${MININET}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
95     Set Suite Variable    ${mininet_conn_id}
96     Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
97     Put File    ${CURDIR}/../topologies/customtopo.py
98     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
99     Execute Command    sudo mn -c
100     Write    ${start}
101     Read Until    mininet>