b36f708b9b65432b9af3bd3fc8aaaf9ae6ec06df
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / 030__configure_exit_ovsdb_node.robot
1 *** Settings ***
2 Documentation     Test suite for Connection Manager
3 Suite Setup       Configure Exit OVSDB Node Suite Setup
4 Suite Teardown    Configure Exit OVSDB Node Suite Teardown
5 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Force Tags        Southbound
7 Library           OperatingSystem
8 Library           String
9 Library           RequestsLibrary
10 Resource          ../../../libraries/SetupUtils.robot
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../libraries/OVSDB.robot
13 Variables         ../../../variables/Variables.py
14
15 *** Variables ***
16 ${OVSDB_PORT}     6634
17 ${BRIDGE}         ovsdb-csit-test-bridge
18 ${SOUTHBOUND_CONFIG_API}    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
19 ${OVSDB_CONFIG_DIR}    ${CURDIR}/../../../variables/ovsdb
20 @{node_list}      ${BRIDGE}    vx1
21
22 *** Test Cases ***
23 Create a Topology in OVSDB node
24     [Documentation]    Create topology in OVSDB and ready it for further tests
25     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
26     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-br ${BRIDGE}
27     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl add-port ${BRIDGE} vx1 -- set Interface vx1 type=vxlan options:remote_ip=192.168.1.11
28     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager ptcp:6634
29
30 Connect to OVSDB Node
31     [Documentation]    Initiate the connection to OVSDB node from controller
32     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/connect.json
33     ${sample1}    Replace String    ${sample}    127.0.0.1    ${TOOLS_SYSTEM_IP}
34     ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
35     Log    URL is ${SOUTHBOUND_CONFIG_API}
36     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
37     Log    ${resp.content}
38     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
39
40 Get Operational Topology
41     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
42     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${node_list}
43     [Teardown]    Report_Failure_Due_To_Bug    5221
44
45 Verify Bridge Port Not In Config DS
46     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
47     @{list}    Create List    vx1
48     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}    ${list}
49
50 Create bridge of already added bridge
51     [Documentation]    This will add bridge to the config datastore
52     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
53     ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6633    tcp:${ODL_SYSTEM_IP}:6633
54     ${sample2}    Replace String    ${sample1}    127.0.0.1    ${TOOLS_SYSTEM_IP}
55     ${sample3}    Replace String    ${sample2}    br01    ${BRIDGE}
56     ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
57     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
58     Log    data: ${body}
59     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}    data=${body}
60     Log    ${resp.content}
61     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
62
63 Get Config Topology with Bridge
64     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
65     @{list}    Create List    ${BRIDGE}
66     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${CONFIG_TOPO_API}    ${list}
67
68 Create Port of already added port in OVSDB
69     [Documentation]    This will add port/interface to the config datastore
70     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
71     ${sample1}    Replace String    ${sample}    vxlanport    vx1
72     ${body}    Replace String    ${sample1}    192.168.0.21    192.168.1.10
73     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/
74     Log    data: ${body}
75     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/    data=${body}
76     Log    ${resp.content}
77     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
78
79 Get Config Topology with Bridge and Port
80     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
81     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${CONFIG_TOPO_API}    ${node_list}
82
83 Modify the destination IP of Port
84     [Documentation]    This will modify the dst ip of existing port
85     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
86     ${sample1}    Replace String    ${sample}    vxlanport    vx1
87     ${body}    Replace String    ${sample1}    192.168.0.21    10.0.0.19
88     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/
89     Log    data: ${body}
90     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/    data=${body}
91     Log    ${resp.content}
92     Should Be Equal As Strings    ${resp.status_code}    200
93
94 Get Operational Topology with modified Port
95     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
96     @{list}    Create List    ${BRIDGE}    vx1    10.0.0.19
97     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
98     [Teardown]    Report_Failure_Due_To_Bug    5221
99
100 Create Port and attach to a Bridge
101     [Documentation]    This request will creates port/interface and attach it to the specific bridge
102     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
103     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
104     Log    data: ${body}
105     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/    data=${body}
106     Log    ${resp.content}
107     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
108
109 Get Operational Topology with Port
110     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
111     @{list}    Create List    ${BRIDGE}    vxlanport
112     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
113     [Teardown]    Report_Failure_Due_To_Bug    5221
114
115 Delete the Port1
116     [Documentation]    This request will delete the port node from the bridge node and data store.
117     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/
118     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
119
120 Get Operational Topology after deletion of Port1
121     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
122     @{list}    Create List    vx1
123     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
124
125 Delete the Port2
126     [Documentation]    This request will delete the port node from the bridge node and data store.
127     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
128     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
129
130 Get Operational Topology after Deletion of Port2
131     [Documentation]    This request will fetch the operational topology after the Port is deleted
132     @{list}    Create List    vxlanport
133     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
134
135 Delete the Bridge
136     [Documentation]    This request will delete the bridge node from the config data store.
137     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
138     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
139
140 Get Operational Topology after Deletion of Bridge
141     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
142     @{list}    Create List    ${BRIDGE}    vxlanport    vx1
143     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
144
145 Delete the OVSDB Node
146     [Documentation]    This request will delete the OVSDB node
147     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}
148     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
149
150 Get Operational Topology after Deletion of OVSDB Node
151     [Documentation]    This request will fetch the operational topology after the OVSDB node is deleted
152     @{list}    Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}    ${BRIDGE}    vxlanport    vx1
153     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
154
155 Check For Bug 4756
156     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
157     ...    case executed
158     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
159     [Teardown]    Report_Failure_Due_To_Bug    4756
160
161 Check For Bug 4794
162     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
163     ...    case executed.
164     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
165     [Teardown]    Report_Failure_Due_To_Bug    4794
166
167 *** Keywords ***
168 Configure Exit OVSDB Node Suite Setup
169     SetupUtils.Setup_Utils_For_Setup_And_Teardown
170     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
171
172 Configure Exit OVSDB Node Suite Teardown
173     [Documentation]    Cleans up test environment, close existing sessions.
174     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
175     RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
176     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
177     Log    ${resp.content}
178     Delete All Sessions