Tidied new and updated test suites
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / Bug_4794.robot
1 *** Settings ***
2 Documentation     Suite to test bug 4794 https://bugs.opendaylight.org/show_bug.cgi?id=4794
3 Suite Setup       OVSDB Connection Manager Suite Setup
4 Suite Teardown    OVSDB Connection Manager 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-4794
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
20 *** Test Cases ***
21 Bug 4794
22     [Documentation]    This test case will recreate the bug using the same basic steps as
23     ...    provided in the bug, and noted here:
24     ...    1) create bridge in config
25     ...    2) connect ovs (vsctl set-manager)
26     ...    3) delete bridge in config
27     ...    4) disconnect ovs (vsctl del-manager)
28     Create Bridge
29     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
30     Log    ${resp.content}
31     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
32     Should Contain    ${resp.content}    ovsdb://uuid/${ovsdb_uuid}/bridge/${BRIDGE}
33     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
34     @{list}    Create List    ${BRIDGE}
35     Run Keyword And Continue On Failure    Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}/topology/ovsdb:1    ${list}
36     ${resp}    RequestsLibrary.Delete Request    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
37     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
38     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
39     Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
40     [Teardown]    Report_Failure_Due_To_Bug    4794
41
42 *** Keywords ***
43 OVSDB Connection Manager Suite Setup
44     Open Controller Karaf Console On Background
45     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
46     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
47     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:6640
48     Wait Until Keyword Succeeds    5s    1s    Verify OVS Reports Connected
49     ${ovsdb_uuid}=    Get OVSDB UUID    ${TOOLS_SYSTEM_IP}
50     Set Suite Variable    ${ovsdb_uuid}
51     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
52
53 OVSDB Connection Manager Suite Teardown
54     [Documentation]    Cleans up test environment, close existing sessions.
55     Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
56     RequestsLibrary.Delete Request    session    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}
57     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
58     Log    ${resp.content}
59     Delete All Sessions
60
61 Create Bridge
62     [Documentation]    This will create bridge on the specified OVSDB node.
63     ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
64     ${body}    Replace String    ${body}    ovsdb://127.0.0.1:61644    ovsdb://uuid/${ovsdb_uuid}
65     ${body}    Replace String    ${body}    tcp:127.0.0.1:6633    tcp:${ODL_SYSTEM_IP}:6640
66     ${body}    Replace String    ${body}    127.0.0.1    ${TOOLS_SYSTEM_IP}
67     ${body}    Replace String    ${body}    br01    ${BRIDGE}
68     ${body}    Replace String    ${body}    61644    ${OVSDB_PORT}
69     ${uri}=    Set Variable    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2Fuuid%2F${ovsdb_uuid}%2Fbridge%2F${BRIDGE}
70     Log    URL is ${uri}
71     Log    data: ${body}
72     ${resp}    RequestsLibrary.Put Request    session    ${uri}    data=${body}
73     Should Be Equal As Strings    ${resp.status_code}    200