Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / ovsdb / Southbound_Domain / 010__configure_1_ovsdb_node.robot
1 *** Settings ***
2 Documentation     Test suite for Connection Manager
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           OperatingSystem
6 Library           String
7 Library           RequestsLibrary
8 Variables         ../../../variables/Variables.py
9 Resource          ../../../libraries/Utils.robot
10
11 *** Variables ***
12 ${OVSDB_PORT}     6634
13 ${BRIDGE}         br01
14 ${SOUTHBOUND_CONFIG_API}    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${MININET}:${OVSDB_PORT}
15 ${OVSDB_CONFIG_DIR}    ${CURDIR}/../../../variables/ovsdb
16 @{node_list}      ovsdb://${MININET}:${OVSDB_PORT}    ${MININET}    ${OVSDB_PORT}    br-int
17
18 *** Test Cases ***
19 Make the OVS instance to listen for connection
20     [Tags]    Southbound
21     Run Command On Remote System    ${MININET}    sudo ovs-vsctl del-manager
22     Run Command On Remote System    ${MININET}    sudo ovs-vsctl set-manager ptcp:6634
23
24 Connect to OVSDB Node
25     [Documentation]    Initiate the connection to OVSDB node from controller
26     [Tags]    Southbound
27     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/connect.json
28     ${sample1}    Replace String    ${sample}    127.0.0.1    ${MININET}
29     ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
30     Log    URL is ${SOUTHBOUND_CONFIG_API}
31     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
32     Log    ${resp.content}
33     Should Be Equal As Strings    ${resp.status_code}    200
34
35 Get Operational Topology
36     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
37     [Tags]    Southbound
38     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${node_list}
39
40 Create a Bridge
41     [Documentation]    This will create bridge on the specified OVSDB node.
42     [Tags]    Southbound
43     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
44     ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6633    tcp:${CONTROLLER}:6633
45     ${sample2}    Replace String    ${sample1}    127.0.0.1    ${MININET}
46     ${sample3}    Replace String    ${sample2}    br01    ${BRIDGE}
47     ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
48     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
49     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}    data=${body}
50     Log    ${resp.content}
51     Should Be Equal As Strings    ${resp.status_code}    200
52
53 Get Config Topology with Bridge
54     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
55     [Tags]    Southbound
56     ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
57     Log    ${resp.content}
58     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
59     Should Contain    ${resp.content}    ${BRIDGE}
60
61 Get Operational Topology with Bridge
62     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
63     [Tags]    Southbound
64     @{list}    Create List    ${BRIDGE}
65     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
66
67 Create Port and attach to a Bridge
68     [Documentation]    This request will creates port/interface and attach it to the specific bridge
69     [Tags]    Southbound
70     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
71     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
72     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/    data=${body}
73     Log    ${resp.content}
74     Should Be Equal As Strings    ${resp.status_code}    200
75
76 Get Operational Topology with Port
77     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
78     [Tags]    Southbound
79     @{list}    Create List    ${BRIDGE}    vxlanport
80     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
81
82 Delete the Port
83     [Documentation]    This request will delete the port node from the bridge node and data store.
84     [Tags]    Southbound
85     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
86     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
87
88 Get Operational Topology after Deletion of Port
89     [Documentation]    This request will fetch the operational topology after the Port is deleted
90     [Tags]    Southbound
91     @{list}    Create List    vxlanport
92     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
93
94 Delete the Bridge
95     [Documentation]    This request will delete the bridge node from the config data store.
96     [Tags]    Southbound
97     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
98     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
99
100 Get Operational Topology after Deletion of Bridge
101     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
102     [Tags]    Southbound
103     @{list}    Create List    ${BRIDGE}    vxlanport
104     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
105
106 Get Config Topology with integration Bridge
107     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
108     [Tags]    Southbound
109     ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
110     Log    ${resp.content}
111     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
112     Should Contain    ${resp.content}    br-int
113
114 Delete the OVSDB Node
115     [Documentation]    This request will delete the OVSDB node
116     [Tags]    Southbound
117     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}
118     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
119
120 Get Operational Topology to make sure the connection has been deleted
121     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
122     [Tags]    Southbound
123     @{list}    Create List    ovsdb://${MININET}:${OVSDB_PORT}
124     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
125
126 Get Configuration Topology to make sure the connection has been deleted
127     [Documentation]    This request will fetch the configuration topology from the connected OVSDB nodes
128     [Tags]    Southbound
129     @{list}    Create List    ovsdb://${MININET}:${OVSDB_PORT}
130     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}    ${node_list}
131
132 Reconnect to OVSDB Node
133     [Documentation]    Initiate the connection to OVSDB node from controller
134     [Tags]    Southbound
135     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/connect.json
136     ${sample1}    Replace String    ${sample}    127.0.0.1    ${MININET}
137     ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
138     Log    URL is ${SOUTHBOUND_CONFIG_API}
139     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
140     Log    ${resp.content}
141     Should Be Equal As Strings    ${resp.status_code}    200
142
143 Get Operational Topology with Integration Bridge
144     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
145     [Tags]    Southbound
146     @{list}    Create List    br-int
147     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
148
149 Get Config Topology after reconnect
150     [Documentation]    This will fetch the configuration topology from configuration data store after reconnect
151     [Tags]    Southbound
152     ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
153     Log    ${resp.content}
154     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
155     Should Contain    ${resp.content}    br-int
156
157 Create integration Bridge
158     [Documentation]    This will create bridge on the specified OVSDB node.
159     [Tags]    Southbound
160     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
161     ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6633    tcp:${CONTROLLER}:6633
162     ${sample2}    Replace String    ${sample1}    127.0.0.1    ${MININET}
163     ${sample3}    Replace String    ${sample2}    br01    br-int
164     ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
165     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
166     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-int    data=${body}
167     Log    ${resp.content}
168     Should Be Equal As Strings    ${resp.status_code}    200
169
170 Delete the integration Bridge
171     [Documentation]    This request will delete the bridge node from the config data store.
172     [Tags]    Southbound
173     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-int
174     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
175
176 Get Operational Topology after Deletion of integration Bridge
177     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
178     [Tags]    Southbound
179     @{list}    Create List    br-int
180     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
181
182 Again Delete the OVSDB Node
183     [Documentation]    This request will delete the OVSDB node
184     [Tags]    Southbound
185     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}
186     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
187
188 Get Operational Topology after Deletion of OVSDB Node
189     [Documentation]    This request will fetch the operational topology after the OVSDB node is deleted
190     [Tags]    Southbound
191     @{list}    Create List    ovsdb://${MININET}:${OVSDB_PORT}    ${BRIDGE}    vxlanport
192     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}