removing validations for netvirt related testing
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / 010__configure_1_ovsdb_node.robot
1 *** Settings ***
2 Documentation     Test suite for Connection Manager
3 Suite Setup       Configure 1 OVSDB Node Suite Setup
4 Suite Teardown    Configure 1 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}      ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}    ${TOOLS_SYSTEM_IP}    ${OVSDB_PORT}
20
21 *** Test Cases ***
22 Make the OVS instance to listen for connection
23     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
24     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager ptcp:${OVSDB_PORT}
25
26 Connect to OVSDB Node
27     [Documentation]    Initiate the connection to OVSDB node from controller
28     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/connect.json
29     ${sample1}    Replace String    ${sample}    127.0.0.1    ${TOOLS_SYSTEM_IP}
30     ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
31     Log    URL is ${SOUTHBOUND_CONFIG_API}
32     Log    data: ${body}
33     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
34     Log    ${resp.content}
35     Should Be Equal As Strings    ${resp.status_code}    200
36     Wait Until Keyword Succeeds    3s    1s    Verify OVS Reports Connected
37
38 Get Operational Topology
39     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
40     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${node_list}
41
42 Create a Bridge
43     [Documentation]    This will create bridge on the specified OVSDB node.
44     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
45     ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6633    tcp:${ODL_SYSTEM_IP}:6633
46     ${sample2}    Replace String    ${sample1}    127.0.0.1    ${TOOLS_SYSTEM_IP}
47     ${sample3}    Replace String    ${sample2}    br01    ${BRIDGE}
48     ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
49     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
50     Log    data: ${body}
51     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}    data=${body}
52     Log    ${resp.content}
53     Should Be Equal As Strings    ${resp.status_code}    200
54
55 Get Config Topology with Bridge
56     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
57     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
58     Log    ${resp.content}
59     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
60     Should Contain    ${resp.content}    ${BRIDGE}
61
62 Get Operational Topology with Bridge
63     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes 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    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${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     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
70     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
71     Log    data: ${body}
72     ${resp}    RequestsLibrary.Put Request    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     @{list}    Create List    ${BRIDGE}    vxlanport
79     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
80
81 Delete the Port
82     [Documentation]    This request will delete the port node from the bridge node and data store.
83     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
84     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
85
86 Get Operational Topology after Deletion of Port
87     [Documentation]    This request will fetch the operational topology after the Port is deleted
88     @{list}    Create List    vxlanport
89     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
90
91 Delete the Bridge
92     [Documentation]    This request will delete the bridge node from the config data store.
93     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
94     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
95
96 Get Operational Topology after Deletion of Bridge
97     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
98     @{list}    Create List    ${BRIDGE}    vxlanport
99     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
100
101 Verify Config Still Has OVS Info
102     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
103     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
104     Log    ${resp.content}
105     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
106     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${node_list}
107
108 Delete the OVSDB Node
109     [Documentation]    This request will delete the OVSDB node
110     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}
111     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
112
113 Get Operational Topology to make sure the connection has been deleted
114     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
115     @{list}    Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
116     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
117
118 Get Configuration Topology to make sure the connection has been deleted
119     [Documentation]    This request will fetch the configuration topology from the connected OVSDB nodes
120     @{list}    Create List    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
121     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${CONFIG_TOPO_API}/topology/ovsdb:1    ${node_list}
122
123 Reconnect to OVSDB Node
124     [Documentation]    Initiate the connection to OVSDB node from controller
125     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/connect.json
126     ${sample1}    Replace String    ${sample}    127.0.0.1    ${TOOLS_SYSTEM_IP}
127     ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
128     Log    URL is ${SOUTHBOUND_CONFIG_API}
129     Log    data: ${body}
130     ${resp}    RequestsLibrary.Put Request    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
131     Log    ${resp.content}
132     Should Be Equal As Strings    ${resp.status_code}    200
133
134 Get Operational Topology After Node Reconnect
135     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
136     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${node_list}
137
138 Get Config Topology After Reconnect
139     [Documentation]    This will fetch the configuration topology from configuration data store after reconnect
140     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
141     Log    ${resp.content}
142     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
143     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${node_list}
144
145 Check For Bug 4756
146     [Documentation]  bug 4756 has been seen in the OVSDB Southbound suites.  This test case should be one of the last test
147     ...    case executed.
148     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
149     [Teardown]    Report_Failure_Due_To_Bug    4756
150
151 Check For Bug 4794
152     [Documentation]  bug 4794 has been seen in the OVSDB Southbound suites.  This test case should be one of the last test
153     ...    case executed.
154     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
155     [Teardown]    Report_Failure_Due_To_Bug    4794
156
157 *** Keywords ***
158 Configure 1 OVSDB Node Suite Setup
159     Open Controller Karaf Console On Background
160     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
161
162 Configure 1 OVSDB Node Suite Teardown
163     [Documentation]  Cleans up test environment, close existing sessions.
164     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
165     RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
166     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
167     Log    ${resp.content}
168     Delete All Sessions