Two more test cases for Tunnel monitoring added
[integration/test.git] / csit / suites / netvirt / Netvirt_Vpnservice / BFD_Monitoring.robot
index 7e851461e2d8867502450b9a0098958b789757fe..74aafa6560ba4811b571a4975ca4ed2ccfd0d912 100644 (file)
@@ -67,33 +67,99 @@ TC01 Verify That Default Tunnel Type Is Set To BFD
     Log    Verify Ping Between VMs on different Compute Nodes
     Wait Until Keyword Succeeds    30s    5s    Verify Ping
 
+TC02 Verify that Tunnel Monitoring can be disabled and monitor interval can be configured through REST
+    [Documentation]    Verify that Tunnel Monitoring can be disabled and monitor interval can be configured through REST
+    Log    Verifying ITM tunnel are present and tunnel status
+    ${output}=    ITM Get Tunnels
+    Log    ${output}
+    Wait Until Keyword Succeeds    10s    5s    Verify Tunnel Status as UP
+    Log    Verifying the BFD based tunnel configuration is on
+    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
+    Log    ${output}
+    Should Contain    ${output}    ${TUNNEL_MONITOR_ON}
+    Log    Disabling the tunnel monitoring from REST
+    TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/disable_tunnel_monitoring    session=session
+    Log    Verifying the tunnel monitoring after disable
+    ${resp}=    RequestsLibrary.Get Request    session    ${TUNNEL_MONITOR_URL}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
+    Should Contain    ${resp.content}    ${BFD_ENABLED_FALSE}
+    Should Contain    ${resp.content}    ${BFD}
+    Log    Verifying the default tunnel monitoring is off
+    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
+    Log    ${output}
+    Should Contain    ${output}    ${TUNNEL_MONITOR_OFF}
+    Wait Until Keyword Succeeds    10s    5s    Verify Tunnel Status as UP
+    Log    Verifying the default monitoring interval i.e 1000ms via REST
+    ${resp}=    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
+    Should Contain    ${resp.content}    ${TMI_1000}
+    Log    Change and verify the default tunnel monitoring interval after monitoring is disabled
+    TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/monitor_interval    mapping={"int":"2000"}    session=session
+    ${resp}=    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
+    Should Contain    ${resp.content}    ${TMI_2000}
+
+TC03 Verify that the monitoring interval value boundaries with Monitoring Enabled
+    [Documentation]    Verify that the monitoring interval value boundaries with Monitoring Enabled
+    Log    Verifying ITM tunnel are present and tunnel status
+    ${output}=    ITM Get Tunnels
+    Log    ${output}
+    Wait Until Keyword Succeeds    10s    5s    Verify Tunnel Status as UP
+    Log    Enabling the tunnel monitoring from REST
+    TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/enable_tunnel_monitoring    session=session
+    Log    Verifying the tunnel monitoring is enabled
+    ${resp}=    RequestsLibrary.Get Request    session    ${TUNNEL_MONITOR_URL}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
+    Should Contain    ${resp.content}    ${BFD_ENABLED_TRUE}
+    Should Contain    ${resp.content}    ${BFD}
+    Log    Verifying the tunnel status
+    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
+    Log    ${output}
+    Should Contain    ${output}    ${TUNNEL_MONITOR_ON}
+    Log    Changing and verifying the tunnel monitoring interval to 1000ms
+    TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/monitor_interval    mapping={"int":"1000"}    session=session
+    ${resp}=    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
+    Should Contain    ${resp.content}    ${TMI_1000}
+    Log    Setting the tunnel monitoring interval to 30000ms
+    TemplatedRequests.Put_As_Json_Templated    folder=${VAR_BASE}/monitor_interval    mapping={"int":"30000"}    session=session
+    Log    Verifying the tunnel monitoring interval to 30000ms
+    Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring    ${TMI_30000}
+    Log    Verifying the tunnel monitoring interval to greater than 30000ms cannot be set
+    ${resp}=    RequestsLibrary.Put Request    session    ${MONITOR_INTERVAL_NEW}    data=${INTERVAL_31000}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_ERROR_CODE}
+    Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring    ${TMI_30000}
+    Log    Verifying the tunnel monitoring interval to 50ms cannot be set
+    ${resp}=    RequestsLibrary.Put Request    session    ${MONITOR_INTERVAL_NEW}    data=${INTERVAL_50}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_ERROR_CODE}
+    Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring    ${TMI_30000}
+    Log    Verifying the tunnel monitoring interval to 0ms cannot be set
+    ${resp}=    RequestsLibrary.Put Request    session    ${MONITOR_INTERVAL_NEW}    data=${INTERVAL_0}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_ERROR_CODE}
+    Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring    ${TMI_30000}
+    Log    Verifying the tunnel monitoring interval to a negative value cannot be set
+    ${resp}=    RequestsLibrary.Put Request    session    ${MONITOR_INTERVAL_NEW}    data=${INTERVAL_NEG}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_ERROR_CODE}
+    Wait Until Keyword Succeeds    10s    1s    Check Tunnel Monitoring    ${TMI_30000}
+
 *** Keywords ***
 Start Suite
     [Documentation]    Run before the suite execution
     DevstackUtils.Devstack Suite Setup
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    Enable ODL Karaf Log
     Presuite Cleanup
     Create Setup
 
 Stop Suite
     [Documentation]    Run after the tests execution
     Delete Setup
-    Disable ODL Karaf Log
     Close All Connections
 
-Enable ODL Karaf Log
-    [Documentation]    Uses log:set TRACE org.opendaylight.netvirt to enable log
-    Log    "Enabled ODL Karaf log for org.opendaylight.netvirt"
-    ${output}=    Issue Command On Karaf Console    log:set TRACE org.opendaylight.netvirt
-    Log    ${output}
-
-Disable ODL Karaf Log
-    [Documentation]    Uses log:set TRACE org.opendaylight.netvirt to enable log
-    Log    "Enabled ODL Karaf log for org.opendaylight.netvirt"
-    ${output}=    Issue Command On Karaf Console    log:set INFO org.opendaylight.netvirt
-    Log    ${output}
-
 Presuite Cleanup
     [Documentation]    Clean the already existing tunnels and tep interfaces
     ${resp}    RequestsLibrary.Delete Request    session    ${TUNNEL_TRANSPORTZONE}
@@ -171,26 +237,13 @@ Verify Flows Are Present
     \    Log    ${line}
     \    ${resp}=    Should Match Regexp    ${line}    ${MAC_REGEX}
 
-Verify Tunnel Status as UP
-    [Documentation]    Verify that the tunnels are UP
-    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW_STATE}
-    Log    ${output}
-    Should Contain    ${output}    ${STATE_UP}
-    Should Not Contain    ${output}    ${STATE_DOWN}
-
-Verify Tunnel Status as DOWN
-    [Documentation]    Verify that the tunnels are DOWN
-    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW_STATE}
-    Log    ${output}
-    Should Contain    ${output}    ${STATE_DOWN}
-
-Verify VXLAN interface
-    [Documentation]    Verify that the VXLAN interfaces are Enabled
-    ${output}=    Issue Command On Karaf Console    ${VXLAN_SHOW}
-    Log    ${output}
-    Should Contain    ${output}    ${STATE_UP}
-    Should Contain    ${output}    ${STATE_ENABLE}
-    Should Not Contain    ${output}    ${STATE_DISABLE}
+Check Tunnel Monitoring
+    [Arguments]    ${TMI_INTERVAL}
+    [Documentation]    Check the tunnel monitoring interval through REST
+    ${resp}    RequestsLibrary.Get Request    session    ${MONITOR_INTERVAL_URL}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    ${RESP_CODE}
+    Should Contain    ${resp.content}    ${TMI_INTERVAL}
 
 Create Tunnel
     [Documentation]    Create tunnels betwee the 2 compute nodes and Openstack controller.