Delete flows at the end
[integration/test.git] / test / csit / suites / base / 050__OVSDB_plugin.txt
1 *** Settings ***
2 Documentation     Test suite for OVSDB plugin
3 Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           SSHLibrary
6 Library           Collections
7 Library           ../../libraries/RequestsLibrary.py
8 Library           ../../libraries/Common.py
9 Library           ../../libraries/Topology.py
10 Variables         ../../variables/Variables.py
11
12 *** Variables ***
13 ${key}             node
14 ${REST_CONTEXT_CM}    /controller/nb/v2/connectionmanager
15 ${REST_CONTEXT_BD}    /controller/nb/v2/networkconfig/bridgedomain
16
17 *** Test Cases ***
18 List connections
19     [Documentation]    Get node connections and validate result
20     [Tags]    Get
21     ${topo_nodes}    Get Nodes From Topology    ${TOPO_TREE_LEVEL}
22     ${resp}    Get    session    ${REST_CONTEXT_CM}/nodes
23     Should Be Equal As Strings   ${resp.status_code}   200
24     ${result}    To JSON    ${resp.content}
25     ${nodes}    Get From Dictionary    ${result}    ${key}
26     List Should Contain Sublist   ${nodes}    ${topo_nodes}
27 Connect to mininet
28     [Documentation]    Connect to mininet, list the nodes and validate result
29     [Tags]    add
30     ${body}   Create Dictionary   type   OVS   id   MININET
31     ${resp}   Put   session   ${REST_CONTEXT_CM}/node/MININET/address/${MININET}/port/6640
32     Should Be Equal As Strings   ${resp.status_code}   200
33     ${result}    To JSON    ${resp.content}
34     Dictionaries Should Be Equal    ${result}   ${body}
35     ${resp}    Get    session    ${REST_CONTEXT_CM}/nodes
36     Should Be Equal As Strings   ${resp.status_code}   200
37     ${result}    To JSON    ${resp.content}
38     ${content}    Get From Dictionary    ${result}    ${key}
39     List Should Contain Value    ${content}    ${body}
40     Sleep   2
41 Add bridge s4
42     [Documentation]    Add bridge s4
43     [Tags]    add
44     ${resp}    Post    session    ${REST_CONTEXT_BD}/bridge/OVS/MININET/s4  data={}
45     Should Be Equal As Strings    ${resp.status_code}    201
46 Delete s1 ports
47     [Documentation]    Delete s1 connected ports
48     [Tags]    delete
49     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth1
50     Should Be Equal As Strings    ${resp.status_code}    200
51     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth2
52     Should Be Equal As Strings    ${resp.status_code}    200
53     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
54     Should Be Equal As Strings    ${resp.status_code}    200
55     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
56     Should Be Equal As Strings    ${resp.status_code}    200
57 Add s4 ports 
58     [Documentation]    Add s4 connected ports
59     [Tags]    add
60     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth1   
61     ...   data={"type":"patch", "CUSTOM":{"peer":"s2-eth3"}}
62     Should Be Equal As Strings    ${resp.status_code}    201
63     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth2 
64     ...   data={"type":"patch", "CUSTOM":{"peer":"s3-eth3"}}
65     Should Be Equal As Strings    ${resp.status_code}    201
66     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
67     ...   data={"type":"patch", "CUSTOM":{"peer":"s4-eth1"}}
68     Should Be Equal As Strings    ${resp.status_code}    201
69     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
70     ...   data={"type":"patch", "CUSTOM":{"peer":"s4-eth2"}}
71     Should Be Equal As Strings    ${resp.status_code}    201
72 Ping h1 to h4
73     [Documentation]    Ping h1 to h4, verify no packet loss
74     [Tags]   Get
75     Sleep   20
76     Write   h1 ping -c 3 h4
77     Sleep   6
78     ${result}    Read
79     Should Contain   ${result}   64 bytes
80 Delete s4 ports
81     [Documentation]    Delete s4 connected ports
82     [Tags]    delete
83     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth1
84     Should Be Equal As Strings    ${resp.status_code}    200
85     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth2
86     Should Be Equal As Strings    ${resp.status_code}    200
87     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
88     Should Be Equal As Strings    ${resp.status_code}    200
89     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
90     Should Be Equal As Strings    ${resp.status_code}    200
91 Add s1 ports 
92     [Documentation]    Add s1 connected ports
93     [Tags]    add
94     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth1
95     ...   data={"type":"patch", "CUSTOM":{"peer":"s2-eth3"}}
96     Should Be Equal As Strings    ${resp.status_code}    201
97     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth2
98     ...   data={"type":"patch", "CUSTOM":{"peer":"s3-eth3"}}
99     Should Be Equal As Strings    ${resp.status_code}    201
100     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
101     ...   data={"type":"patch", "CUSTOM":{"peer":"s1-eth1"}}
102     Should Be Equal As Strings    ${resp.status_code}    201
103     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
104     ...   data={"type":"patch", "CUSTOM":{"peer":"s1-eth2"}}
105     Should Be Equal As Strings    ${resp.status_code}    201
106 Delete bridge s4
107     [Documentation]    Delete bridge s4
108     [Tags]    Delete
109     ${resp}    Delete    session    ${REST_CONTEXT_BD}/bridge/OVS/MININET/s4
110     Should Be Equal As Strings    ${resp.status_code}    200
111 Disconnect mininet
112     [Documentation]    Disconnect mininet, list the nodes and validate result
113     [Tags]    delete
114     ${body}   Create Dictionary   type   OVS   id   MININET
115     ${resp}   Delete   session   ${REST_CONTEXT_CM}/node/OVS/MININET
116     Should Be Equal As Strings   ${resp.status_code}   200
117     ${resp}    Get    session    ${REST_CONTEXT_CM}/nodes
118     Should Be Equal As Strings   ${resp.status_code}   200
119     ${result}    To JSON    ${resp.content}
120     ${content}    Get From Dictionary    ${result}    ${key}
121     List Should Not Contain Value    ${content}    ${body}
122 Remove flows
123     [Documentation]    Remove flows generated by simple fwd
124     [Tags]   Get
125     Write   dpctl del-flows
126     Sleep   1
127     Read
128