refactoring Bug suite
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / Bug_Validation.robot
1 *** Settings ***
2 Documentation     Collection of test cases to validate OVSDB projects bugs.
3 ...               -  https://bugs.opendaylight.org/show_bug.cgi?id=4794
4 ...               -  https://bugs.opendaylight.org/show_bug.cgi?id=5177
5 Suite Setup       OVSDB Connection Manager Suite Setup
6 Suite Teardown    OVSDB Connection Manager Suite Teardown
7 Test Setup        Log Testcase Start To Controller Karaf
8 Force Tags        Southbound
9 Library           OperatingSystem
10 Library           String
11 Library           RequestsLibrary
12 Variables         ../../../variables/Variables.py
13 Resource          ../../../libraries/Utils.robot
14 Resource          ../../../libraries/WaitForFailure.robot
15 Resource          ../../../libraries/OVSDB.robot
16
17 *** Variables ***
18 ${OVSDB_PORT}     6634
19 ${BRIDGE}         ovsdb-csit-test-5177
20 ${SOUTHBOUND_CONFIG_API}    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${TOOLS_SYSTEM_IP}:${OVSDB_PORT}
21 ${OVSDB_CONFIG_DIR}    ${CURDIR}/../../../variables/ovsdb
22
23 *** Test Cases ***
24 Bug 5177
25     [Documentation]    This test case will recreate the bug using the same basic steps as
26     ...    provided in the bug, and noted here:
27     ...    1) create bridge in config using the UUID determined in Suite Setup
28     ...    2) connect ovs (vsctl set-manager)
29     ...    3) Fail if node is not discovered in Operational Store
30     Create Bridge
31     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
32     Log    ${resp.content}
33     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
34     Should Contain    ${resp.content}    ovsdb://uuid/${ovsdb_uuid}/bridge/${BRIDGE}
35     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
36     @{list}    Create List    ${BRIDGE}
37     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
38     [Teardown]    Report_Failure_Due_To_Bug    5177
39
40 Bug 4794
41     [Documentation]    This test is dependent on the work done in the Bug 5177 test case so should
42     ...    always be executed immediately after.
43     ...    1) delete bridge in config
44     ...    2) Poll and Fail if exception is seen in karaf.log
45     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
46     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
47     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
48     # If the exception is seen in karaf.log within 10s, the following line will FAIL, which is the point.
49     Verify_Keyword_Does_Not_Fail_Within_Timeout    10s    1s
50     ...    Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
51     [Teardown]    Report_Failure_Due_To_Bug    4794
52
53 *** Keywords ***
54 OVSDB Connection Manager Suite Setup
55     Open Controller Karaf Console On Background
56     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
57     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
58     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
59     Wait Until Keyword Succeeds    5s    1s    Verify OVS Reports Connected
60     ${ovsdb_uuid}=    Get OVSDB UUID    ${TOOLS_SYSTEM_IP}
61     Set Suite Variable    ${ovsdb_uuid}
62     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
63
64 OVSDB Connection Manager Suite Teardown
65     [Documentation]    Cleans up test environment, close existing sessions.
66     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
67     RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}
68     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
69     Log    ${resp.content}
70     Delete All Sessions
71
72 Create Bridge
73     [Documentation]    This will create bridge on the specified OVSDB node.
74     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
75     ${body}    Replace String    ${body}    ovsdb://127.0.0.1:61644    ovsdb://uuid/${ovsdb_uuid}
76     ${body}    Replace String    ${body}    tcp:127.0.0.1:6633    tcp:${ODL_SYSTEM_IP}:6640
77     ${body}    Replace String    ${body}    127.0.0.1    ${TOOLS_SYSTEM_IP}
78     ${body}    Replace String    ${body}    br01    ${BRIDGE}
79     ${body}    Replace String    ${body}    61644    ${OVSDB_PORT}
80     ${uri}=    Set Variable    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}
81     Log    URL is ${uri}
82     Log    data: ${body}
83     ${resp}    RequestsLibrary.Put Request    session    ${uri}    data=${body}
84     Should Be Equal As Strings    ${resp.status_code}    200