Cleanup ovsdb suites
[integration/test.git] / csit / suites / ovsdb / Southbound_Domain / 040__Vxlan_Extension_Test.robot
1 *** Settings ***
2 Documentation     Test suite for Connection Manager
3 Suite Setup       OVSDB.Suite Setup
4 Suite Teardown    Suite Teardown
5 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
6 Force Tags        Southbound
7 Library           RequestsLibrary
8 Resource          ../../../libraries/MininetKeywords.robot
9 Resource          ../../../libraries/OVSDB.robot
10 Resource          ../../../libraries/SetupUtils.robot
11 Resource          ../../../libraries/Utils.robot
12 Resource          ../../../variables/Variables.robot
13
14 *** Variables ***
15 @{NODE_LIST}      ${OVSDB_NODE_PORT}    ovsdb://${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_IP}    ${OVSDB_NODE_PORT}    ovsdb://${TOOLS_SYSTEM_2_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_2_IP}
16 ${MN_OPTS_S1}     --switch=ovsk,protocols=OpenFlow13 --custom ovsdb.py --topo host,1
17 ${MN_OPTS_S2}     --switch=ovsk,protocols=OpenFlow13 --custom ovsdb.py --topo host,2
18
19 *** Test Cases ***
20 Make the OVS instance to listen for connection
21     Utils.Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl del-manager
22     Utils.Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
23     Utils.Run Command On Remote System    ${TOOLS_SYSTEM_2_IP}    sudo ovs-vsctl del-manager
24     Utils.Run Command On Remote System    ${TOOLS_SYSTEM_2_IP}    sudo ovs-vsctl set-manager ptcp:${OVSDB_NODE_PORT}
25
26 Connect controller to OVSDB Node1
27     [Documentation]    Initiate the connection to OVSDB node from controller
28     OVSDB.Connect To Ovsdb Node    ${TOOLS_SYSTEM_IP}
29
30 Connect controller to OVSDB Node2
31     [Documentation]    Initiate the connection to OVSDB node from controller
32     OVSDB.Connect To Ovsdb Node    ${TOOLS_SYSTEM_2_IP}
33
34 Get Operational Topology from OVSDB Node1 and OVSDB Node2
35     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
36     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${NODE_LIST}    pretty_print_json=True
37
38 Start the Mininet and create custom topology
39     [Documentation]    This will start mininet with custom topology on both the Virtual Machines
40     ${conn_id1} =    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_IP}    ${ODL_SYSTEM_IP}    ${MN_OPTS_S1}    ${OVSDB_CONFIG_DIR}/ovsdb.py
41     ${conn_id2} =    MininetKeywords.Start Mininet Single Controller    ${TOOLS_SYSTEM_2_IP}    ${ODL_SYSTEM_IP}    ${MN_OPTS_S2}    ${OVSDB_CONFIG_DIR}/ovsdb.py
42
43 Get Operational Topology with custom topology
44     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to make sure the mininet created custom topology
45     @{list} =    BuiltIn.Create List    s1    s2
46     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}    pretty_print_json=True
47
48 Add the bridge s1 in the config datastore of OVSDB Node1
49     [Documentation]    This request will add already operational bridge to the config data store of the OVSDB node.
50     OVSDB.Add Bridge To Ovsdb Node    ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_IP}    s1    0000000000000051
51
52 Add the bridge s2 in the config datastore of OVSDB Node2
53     [Documentation]    This request will add already operational bridge to the config data store of the OVSDB node.
54     OVSDB.Add Bridge To Ovsdb Node    ${TOOLS_SYSTEM2_IP}:${OVSDB_NODE_PORT}    ${TOOLS_SYSTEM_2_IP}    s2    0000000000000052
55
56 Get Config Topology with s1 and s2 Bridges
57     [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the config data store
58     @{list} =    BuiltIn.Create List    s1    s2
59     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${CONFIG_TOPO_API}    ${list}    pretty_print_json=True
60
61 Create Vxlan Port and attach to s1 Bridge
62     [Documentation]    This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s1 of OVSDB node 1
63     OVSDB.Add Vxlan To Bridge    ${TOOLS_SYSTEM_IP}    s1    s1-s2    ${TOOLS_SYSTEM_2_IP}
64
65 Create Vxlan Port and attach to s2 Bridge
66     [Documentation]    This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s2 of OVSDB node 2
67     OVSDB.Add Vxlan To Bridge    ${TOOLS_SYSTEM_2_IP}    s2    s2-s1    ${TOOLS_SYSTEM_IP}
68
69 Get Operational Topology with vxlan tunnel
70     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify that the vxlan tunnel is created
71     @{list} =    BuiltIn.Create List    s1-s2    s2-s1    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}
72     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}    pretty_print_json=True
73
74 Delete Bridges from config datastore
75     [Documentation]    This request will delete the bridges from config data store.
76     [Tags]    Southbound
77     OVSDB.Delete Bridge From Ovsdb Node    ${TOOLS_SYSTEM_IP}:${OVSDB_NODE_PORT}    s1
78     OVSDB.Delete Bridge From Ovsdb Node    ${TOOLS_SYSTEM_2_IP}:${OVSDB_NODE_PORT}    s2
79
80 Disconnect controller connection from the connected OVSDBs nodes
81     [Documentation]    This request will disconnect the controller from the connected OVSDB node for clean startup for next suite.
82     [Tags]    Southbound
83     OVSDB.Disconnect From Ovsdb Node    ${TOOLS_SYSTEM_IP}
84     OVSDB.Disconnect From Ovsdb Node    ${TOOLS_SYSTEM_2_IP}
85
86 Verify that the operational topology is clean
87     [Documentation]    This request will verify the operational toplogy after the mininet is cleaned.
88     [Tags]    Southbound
89     @{list} =    BuiltIn.Create List    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    s1    s2
90     BuiltIn.Wait Until Keyword Succeeds    8s    2s    Utils.Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}    pretty_print_json=True
91
92 Check For Bug 4756
93     [Documentation]    bug 4756 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
94     ...    case executed.
95     Utils.Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    SimpleShardDataTreeCohort.*Unexpected failure in validation phase
96     [Teardown]    Utils.Report_Failure_Due_To_Bug    4756
97
98 Check For Bug 4794
99     [Documentation]    bug 4794 has been seen in the OVSDB Southbound suites. This test case should be one of the last test
100     ...    case executed.
101     Utils.Check Karaf Log File Does Not Have Messages    ${ODL_SYSTEM_IP}    Shard.*shard-topology-operational An exception occurred while preCommitting transaction
102     [Teardown]    Utils.Report_Failure_Due_To_Bug    4794
103
104 *** Keywords ***
105 Suite Teardown
106     [Documentation]    Cleans up test environment, close existing sessions.
107     OVSDB.Clean OVSDB Test Environment    ${TOOLS_SYSTEM_IP}
108     OVSDB.Clean OVSDB Test Environment    ${TOOLS_SYSTEM_2_IP}
109     ${resp} =    RequestsLibrary.Get Request    session    ${CONFIG_TOPO_API}
110     OVSDB.Log Config And Operational Topology
111     RequestsLibrary.Delete All Sessions