Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / ovsdb / Southbound_Domain / 030__configure_exit_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}         br-s1
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}      ${BRIDGE}    vx1
17
18 *** Test Cases ***
19 Create a Topology in OVSDB node
20     [Documentation]    Create topology in OVSDB and ready it for further tests
21     [Tags]    Southbound
22     Run Command On Remote System    ${MININET}    sudo ovs-vsctl del-manager
23     Run Command On Remote System    ${MININET}    sudo ovs-vsctl del-br br-int
24     Run Command On Remote System    ${MININET}    sudo ovs-vsctl add-br ${BRIDGE}
25     Run Command On Remote System    ${MININET}    sudo ovs-vsctl add-port ${BRIDGE} vx1 -- set Interface vx1 type=vxlan options:remote_ip=192.168.1.11
26     Run Command On Remote System    ${MININET}    sudo ovs-vsctl set-manager ptcp:6634
27
28 Connect to OVSDB Node
29     [Documentation]    Initiate the connection to OVSDB node from controller
30     [Tags]    Southbound
31     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/connect.json
32     ${sample1}    Replace String    ${sample}    127.0.0.1    ${MININET}
33     ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
34     Log    URL is ${SOUTHBOUND_CONFIG_API}
35     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
36     Log    ${resp.content}
37     Should Be Equal As Strings    ${resp.status_code}    200
38
39 Get Operational Topology
40     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
41     [Tags]    Southbound
42     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${node_list}
43
44 Get Config Topology without Bridge
45     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
46     [Tags]    Southbound
47     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}    ${node_list}
48
49 Delete the integration Bridge
50     [Documentation]    This request will delete the bridge node from the config data store.
51     [Tags]    Southbound
52     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-int
53     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
54
55 Get Operational Topology after deletion of integration bridge
56     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
57     [Tags]    Southbound
58     @{list}    Create List    br-int
59     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
60
61 Create bridge of already added bridge
62     [Documentation]    This will add bridge to the config datastore
63     [Tags]    Southbound
64     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
65     ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6633    tcp:${CONTROLLER}:6633
66     ${sample2}    Replace String    ${sample1}    127.0.0.1    ${MININET}
67     ${sample3}    Replace String    ${sample2}    br01    ${BRIDGE}
68     ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
69     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
70     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}    data=${body}
71     Log    ${resp.content}
72     Should Be Equal As Strings    ${resp.status_code}    200
73
74 Get Config Topology with Bridge
75     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
76     [Tags]    Southbound
77     @{list}    Create List    br-s1
78     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${CONFIG_TOPO_API}    ${list}
79
80 Create Port of already added port in OVSDB
81     [Documentation]    This will add port/interface to the config datastore
82     [Tags]    Southbound
83     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
84     ${sample1}    Replace String    ${sample}    vxlanport    vx1
85     ${body}    Replace String    ${sample1}    192.168.0.21    192.168.1.10
86     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/
87     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/    data=${body}
88     Log    ${resp.content}
89     Should Be Equal As Strings    ${resp.status_code}    200
90
91 Get Config Topology with Bridge and Port
92     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
93     [Tags]    Southbound
94     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${CONFIG_TOPO_API}    ${node_list}
95
96 Modify the destination IP of Port
97     [Documentation]    This will modify the dst ip of existing port
98     [Tags]    Southbound
99     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
100     ${sample1}    Replace String    ${sample}    vxlanport    vx1
101     ${body}    Replace String    ${sample1}    192.168.0.21    10.0.0.19
102     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/
103     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/    data=${body}
104     Log    ${resp.content}
105     Should Be Equal As Strings    ${resp.status_code}    200
106
107 Get Operational Topology with modified Port
108     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
109     [Tags]    Southbound
110     @{list}    Create List    ${BRIDGE}    vx1    10.0.0.19
111     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
112
113 Create Port and attach to a Bridge
114     [Documentation]    This request will creates port/interface and attach it to the specific bridge
115     [Tags]    Southbound
116     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
117     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
118     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/    data=${body}
119     Log    ${resp.content}
120     Should Be Equal As Strings    ${resp.status_code}    200
121
122 Get Operational Topology with Port
123     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
124     [Tags]    Southbound
125     @{list}    Create List    ${BRIDGE}    vxlanport
126     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
127
128 Delete the Port1
129     [Documentation]    This request will delete the port node from the bridge node and data store.
130     [Tags]    Southbound
131     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/
132     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
133
134 Get Operational Topology after deletion of Port1
135     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
136     [Tags]    Southbound
137     @{list}    Create List    vx1
138     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
139
140 Delete the Port2
141     [Documentation]    This request will delete the port node from the bridge node and data store.
142     [Tags]    Southbound
143     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
144     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
145
146 Get Operational Topology after Deletion of Port2
147     [Documentation]    This request will fetch the operational topology after the Port is deleted
148     [Tags]    Southbound
149     @{list}    Create List    vxlanport
150     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
151
152 Delete the Bridge
153     [Documentation]    This request will delete the bridge node from the config data store.
154     [Tags]    Southbound
155     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
156     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
157
158 Get Operational Topology after Deletion of Bridge
159     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
160     [Tags]    Southbound
161     @{list}    Create List    ${BRIDGE}    vxlanport    vx1
162     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
163
164 Delete the OVSDB Node
165     [Documentation]    This request will delete the OVSDB node
166     [Tags]    Southbound
167     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}
168     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
169
170 Get Operational Topology after Deletion of OVSDB Node
171     [Documentation]    This request will fetch the operational topology after the OVSDB node is deleted
172     [Tags]    Southbound
173     @{list}    Create List    ovsdb://${MININET}:${OVSDB_PORT}    ${BRIDGE}    vxlanport    vx1
174     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}