058327955c73c0907c5972dbdbb9d5d65b52fc3f
[integration/test.git] / test / csit / suites / ovsdb / Bridge_Domain_OF13 / 010__bridge_domain.robot
1 *** Settings ***
2 Documentation     Test suite for OVSDB Bridge Domain
3 Suite Setup       Create Session   session   http://${CONTROLLER}:${RESTPORT}   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]    ovsdb
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]    ovsdb
30     ${body}   Create Dictionary   type   OVS   id   MININET
31     ${resp}   Put   session   ${REST_CONTEXT_CM}/node/MININET/address/${MININET}/port/6644
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]    ovsdb
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]    ovsdb
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]    ovsdb
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]    ovsdb
75     Sleep   5
76     Write   h1 ping -w 10 h4
77     Sleep   10
78     Write   h4 ping -w 10 h1
79     Sleep   10
80     ${result}    Read
81     Should Contain   ${result}   64 bytes
82 Delete s4 ports
83     [Documentation]    Delete s4 connected ports
84     [Tags]    ovsdb
85     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth1
86     Should Be Equal As Strings    ${resp.status_code}    200
87     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s4/s4-eth2
88     Should Be Equal As Strings    ${resp.status_code}    200
89     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
90     Should Be Equal As Strings    ${resp.status_code}    200
91     ${resp}    Delete   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
92     Should Be Equal As Strings    ${resp.status_code}    200
93 Add s1 ports 
94     [Documentation]    Add s1 connected ports
95     [Tags]    ovsdb
96     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth1
97     ...   data={"type":"patch", "CUSTOM":{"peer":"s2-eth3"}}
98     Should Be Equal As Strings    ${resp.status_code}    201
99     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s1/s1-eth2
100     ...   data={"type":"patch", "CUSTOM":{"peer":"s3-eth3"}}
101     Should Be Equal As Strings    ${resp.status_code}    201
102     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s2/s2-eth3
103     ...   data={"type":"patch", "CUSTOM":{"peer":"s1-eth1"}}
104     Should Be Equal As Strings    ${resp.status_code}    201
105     ${resp}   Post   session   ${REST_CONTEXT_BD}/port/OVS/MININET/s3/s3-eth3
106     ...   data={"type":"patch", "CUSTOM":{"peer":"s1-eth2"}}
107     Should Be Equal As Strings    ${resp.status_code}    201
108 Delete bridge s4
109     [Documentation]    Delete bridge s4
110     [Tags]    ovsdb
111     ${resp}    Delete    session    ${REST_CONTEXT_BD}/bridge/OVS/MININET/s4
112     Should Be Equal As Strings    ${resp.status_code}    200
113 Disconnect mininet
114     [Documentation]    Disconnect mininet, list the nodes and validate result
115     [Tags]    ovsdb
116     ${body}   Create Dictionary   type   OVS   id   MININET
117     ${resp}   Delete   session   ${REST_CONTEXT_CM}/node/OVS/MININET
118     Should Be Equal As Strings   ${resp.status_code}   200
119     ${resp}    Get    session    ${REST_CONTEXT_CM}/nodes
120     Should Be Equal As Strings   ${resp.status_code}   200
121     ${result}    To JSON    ${resp.content}
122     ${content}    Get From Dictionary    ${result}    ${key}
123     List Should Not Contain Value    ${content}    ${body}