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