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