Merge "Rename cases to modules and minor bug fix"
[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 port s1-eth1
47     [Documentation]    Delete bridge s1 port s1-eth1
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 Delete s1 port s1-eth2
52     [Documentation]    Delete bridge s1 port s1-eth2
53     [Tags]    delete
54     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth2
55     Should Be Equal As Strings    ${resp.status_code}    200
56 Delete s2 port s2-eth3
57     [Documentation]    Delete bridge s2 port s2-eth3
58     [Tags]    delete
59     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
60     Should Be Equal As Strings    ${resp.status_code}    200
61 Delete s3 port s3-eth3
62     [Documentation]    Delete bridge s3 port s3-eth3
63     [Tags]    delete
64     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
65     Should Be Equal As Strings    ${resp.status_code}    200
66 Add s4 port s4-eth1
67     [Documentation]    Add s4 port s4-eth1 and patch to s2 port s2-eth3
68     [Tags]    add
69     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth1   
70     ...   data={"type":"patch", "CUSTOM":{"peer":"s2-eth3"}}
71     Should Be Equal As Strings    ${resp.status_code}    201
72 Add s4 port s4-eth2
73     [Documentation]    Add s4 port s4-eth2 and patch to s3 port s3-eth3
74     [Tags]    add
75     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth2 
76     ...   data={"type":"patch", "CUSTOM":{"peer":"s3-eth3"}}
77     Should Be Equal As Strings    ${resp.status_code}    201
78 Add s2 port s2-eth3
79     [Documentation]    Add s2 port s2-eth3 and patch to s4 port s4-eth1
80     [Tags]    add
81     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
82     ...   data={"type":"patch", "CUSTOM":{"peer":"s4-eth1"}}
83     Should Be Equal As Strings    ${resp.status_code}    201
84 Add s3 port s3-eth3
85     [Documentation]    Add s3 port s3-eth3 and patch to s4 port s4-eth2
86     [Tags]    add
87     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
88     ...   data={"type":"patch", "CUSTOM":{"peer":"s4-eth2"}}
89     Should Be Equal As Strings    ${resp.status_code}    201
90 Delete bridge s1
91     [Documentation]    Delete bridge s1 
92     [Tags]    Delete
93     ${resp}    Delete    session    ${REST_CONTEXT_BD}/bridge/OVS/MININET/s1
94     Should Be Equal As Strings    ${resp.status_code}    200
95     Sleep   5
96 Ping h1 to h4
97     [Documentation]    Ping h1 to h4, verify no packet loss
98     [Tags]   Get
99     Write   h1 ping -c 3 h4
100     Sleep   6
101     ${result}    Read
102     Should Contain   ${result}   64 bytes 
103 Disconnect mininet
104     [Documentation]    Disconnect mininet, list the nodes and validate result
105     [Tags]    delete
106     ${body}   Create Dictionary   type   OVS   id   MININET
107     ${resp}   Delete   session   ${REST_CONTEXT_CM}/node/OVS/MININET
108     Should Be Equal As Strings   ${resp.status_code}   200
109     ${resp}    Get    session    ${REST_CONTEXT_CM}/nodes
110     Should Be Equal As Strings   ${resp.status_code}   200
111     ${result}    To JSON    ${resp.content}
112     ${content}    Get From Dictionary    ${result}    ${key}
113     List Should Not Contain Value    ${content}    ${body}