removing validations for netvirt related testing
[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    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    4756
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
98 Create Port and attach to a Bridge
99     [Documentation]    This request will creates port/interface and attach it to the specific bridge
100     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
101     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
102     Log    data: ${body}
103     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/    data=${body}
104     Log    ${resp.content}
105     Should Be Equal As Strings    ${resp.status_code}    200
106
107 Get Operational Topology with Port
108     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
109     @{list}    Create List    ${BRIDGE}    vxlanport
110     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
111
112 Delete the Port1
113     [Documentation]    This request will delete the port node from the bridge node and data store.
114     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vx1/
115     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
116
117 Get Operational Topology after deletion of Port1
118     [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
119     @{list}    Create List    vx1
120     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
121
122 Delete the Port2
123     [Documentation]    This request will delete the port node from the bridge node and data store.
124     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
125     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
126
127 Get Operational Topology after Deletion of Port2
128     [Documentation]    This request will fetch the operational topology after the Port is deleted
129     @{list}    Create List    vxlanport
130     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
131
132 Delete the Bridge
133     [Documentation]    This request will delete the bridge node from the config data store.
134     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
135     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
136
137 Get Operational Topology after Deletion of Bridge
138     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
139     @{list}    Create List    ${BRIDGE}    vxlanport    vx1
140     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
141
142 Delete the OVSDB Node
143     [Documentation]    This request will delete the OVSDB node
144     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}
145     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
146
147 Get Operational Topology after Deletion of OVSDB Node
148     [Documentation]    This request will fetch the operational topology after the OVSDB node is deleted
149     @{list}    Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}    ${BRIDGE}    vxlanport    vx1
150     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
151
152 Check For Bug 4756
153     [Documentation]  bug 4756 has been seen in the OVSDB Southbound suites.  This test case should be one of the last test
154     ...    case executed.
155     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
156     [Teardown]    Report_Failure_Due_To_Bug    4756
157
158 Check For Bug 4794
159     [Documentation]  bug 4794 has been seen in the OVSDB Southbound suites.  This test case should be one of the last test
160     ...    case executed.
161     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
162     [Teardown]    Report_Failure_Due_To_Bug    4794
163
164 *** Keywords ***
165 Configure Exit OVSDB Node Suite Setup
166     Open Controller Karaf Console On Background
167     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
168
169 Configure Exit OVSDB Node Suite Teardown
170     [Documentation]  Cleans up test environment, close existing sessions.
171     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
172     RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
173     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
174     Log    ${resp.content}
175     Delete All Sessions