084d35395a04a1b35055dc79e31d0bac8439df7f
[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           Collections
6 Library           ../../libraries/RequestsLibrary.py
7 Library           ../../libraries/Common.py
8 Library           ../../libraries/Topology.py
9 Variables         ../../variables/Variables.py
10
11 *** Variables ***
12 ${key}             node
13 ${REST_CONTEXT_CM}    /controller/nb/v2/connectionmanager
14 ${REST_CONTEXT_BD}    /controller/nb/v2/networkconfig/bridgedomain
15
16 *** Test Cases ***
17 List connections
18     [Documentation]    Get node connections and validate result
19     [Tags]    Get
20     ${topo_nodes}    Get Nodes From Topology    ${TOPO_TREE_LEVEL}
21     ${resp}    Get    session    ${REST_CONTEXT_CM}/nodes
22     Should Be Equal As Strings   ${resp.status_code}   200
23     ${result}    To JSON    ${resp.content}
24     ${nodes}    Get From Dictionary    ${result}    ${key}
25     List Should Contain Sublist   ${nodes}    ${topo_nodes}
26 Connect to mininet
27     [Documentation]    Connect to mininet, list the nodes and validate result
28     [Tags]    add
29     ${body}   Create Dictionary   type   OVS   id   MININET
30     ${resp}   Put   session   ${REST_CONTEXT_CM}/node/MININET/address/${MININET}/port/6640
31     Should Be Equal As Strings   ${resp.status_code}   200
32     ${result}    To JSON    ${resp.content}
33     Dictionaries Should Be Equal    ${result}   ${body}
34     ${resp}    Get    session    ${REST_CONTEXT_CM}/nodes
35     Should Be Equal As Strings   ${resp.status_code}   200
36     ${result}    To JSON    ${resp.content}
37     ${content}    Get From Dictionary    ${result}    ${key}
38     List Should Contain Value    ${content}    ${body}
39     Sleep   1
40 Add bridge s4
41     [Documentation]    Add bridge s4
42     [Tags]    add
43     ${resp}    Post    session    ${REST_CONTEXT_BD}/bridge/OVS/MININET/s4  data={}
44     Should Be Equal As Strings    ${resp.status_code}    201
45 Delete s1 port s1-eth1
46     [Documentation]    Delete bridge s1 port s1-eth1
47     [Tags]    delete
48     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth1
49     Should Be Equal As Strings    ${resp.status_code}    200
50 Delete s1 port s1-eth2
51     [Documentation]    Delete bridge s1 port s1-eth2
52     [Tags]    delete
53     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth2
54     Should Be Equal As Strings    ${resp.status_code}    200
55 Delete s2 port s2-eth3
56     [Documentation]    Delete bridge s2 port s2-eth3
57     [Tags]    delete
58     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
59     Should Be Equal As Strings    ${resp.status_code}    200
60 Delete s3 port s3-eth3
61     [Documentation]    Delete bridge s3 port s3-eth3
62     [Tags]    delete
63     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
64     Should Be Equal As Strings    ${resp.status_code}    200
65 Add s4 port s4-eth1
66     [Documentation]    Add s4 port s4-eth1 and patch to s2 port s2-eth3
67     [Tags]    add
68     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth1   
69     ...   data={"type":"patch", "CUSTOM":{"peer":"s2-eth3"}}
70     Should Be Equal As Strings    ${resp.status_code}    201
71 Add s4 port s4-eth2
72     [Documentation]    Add s4 port s4-eth2 and patch to s3 port s3-eth3
73     [Tags]    add
74     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth2 
75     ...   data={"type":"patch", "CUSTOM":{"peer":"s3-eth3"}}
76     Should Be Equal As Strings    ${resp.status_code}    201
77 Add s2 port s2-eth3
78     [Documentation]    Add s2 port s2-eth3 and patch to s4 port s4-eth1
79     [Tags]    add
80     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
81     ...   data={"type":"patch", "CUSTOM":{"peer":"s4-eth1"}}
82     Should Be Equal As Strings    ${resp.status_code}    201
83 Add s3 port s3-eth3
84     [Documentation]    Add s3 port s3-eth3 and patch to s4 port s4-eth2
85     [Tags]    add
86     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
87     ...   data={"type":"patch", "CUSTOM":{"peer":"s4-eth2"}}
88     Should Be Equal As Strings    ${resp.status_code}    201
89 Delete bridge s1
90     [Documentation]    Delete bridge s1 
91     [Tags]    Delete
92     ${resp}    Delete    session    ${REST_CONTEXT_BD}/bridge/OVS/MININET/s1
93     Should Be Equal As Strings    ${resp.status_code}    200
94 Disconnect mininet
95     [Documentation]    Disconnect mininet, list the nodes and validate result
96     [Tags]    delete
97     ${body}   Create Dictionary   type   OVS   id   MININET
98     ${resp}   Delete   session   ${REST_CONTEXT_CM}/node/OVS/MININET
99     Should Be Equal As Strings   ${resp.status_code}   200
100     ${resp}    Get    session    ${REST_CONTEXT_CM}/nodes
101     Should Be Equal As Strings   ${resp.status_code}   200
102     ${result}    To JSON    ${resp.content}
103     ${content}    Get From Dictionary    ${result}    ${key}
104     List Should Not Contain Value    ${content}    ${body}
105