Add suite setup keywords
[integration/test.git] / csit / suites / genius / BFD_monitoring.robot
index 5e07e465ed3c6b2e0703c1cdd1d19ea8a807b7e6..85e868d9d5d0b8db27d9d7f87ac531dbca92469e 100644 (file)
@@ -2,6 +2,7 @@
 Documentation     Test Suite for BFD tunnel monitoring
 Suite Setup       Genius Suite Setup
 Suite Teardown    BFD Suite Stop
 Documentation     Test Suite for BFD tunnel monitoring
 Suite Setup       Genius Suite Setup
 Suite Teardown    BFD Suite Stop
+Test Setup        Genius Test Setup
 Test Teardown     Genius Test Teardown    ${data_models}
 Library           OperatingSystem
 Library           String
 Test Teardown     Genius Test Teardown    ${data_models}
 Library           OperatingSystem
 Library           String
@@ -48,7 +49,7 @@ BFD_TC00 Create ITM between DPNs Verify_BFD_Enablement
     ${vlan}=    Set Variable    0
     ${gateway-ip}=    Set Variable    0.0.0.0
     Genius.Create Vteps    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
     ${vlan}=    Set Variable    0
     ${gateway-ip}=    Set Variable    0.0.0.0
     Genius.Create Vteps    ${Dpn_id_1}    ${Dpn_id_2}    ${TOOLS_SYSTEM_IP}    ${TOOLS_SYSTEM_2_IP}    ${vlan}    ${gateway-ip}
-    Wait Until Keyword Succeeds    30s    5s    Genius.Verify Tunnel Status as UP
+    Wait Until Keyword Succeeds    30s    5s    Genius.Verify Tunnel Status as UP    TZA
 
 BFD_TC01 Verify by default BFD monitoring is enabled on Controller
     [Documentation]    Verify by default BFD monitoring is enabled on Controller
 
 BFD_TC01 Verify by default BFD monitoring is enabled on Controller
     [Documentation]    Verify by default BFD monitoring is enabled on Controller
@@ -57,35 +58,27 @@ BFD_TC01 Verify by default BFD monitoring is enabled on Controller
 
 BFD_TC02 Verify that BFD tunnel monitoring interval is set with appropriate default value i.e.,1000
     [Documentation]    This will verify BFD tunnel monitoring default interval
 
 BFD_TC02 Verify that BFD tunnel monitoring interval is set with appropriate default value i.e.,1000
     [Documentation]    This will verify BFD tunnel monitoring default interval
-    ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
-    Should Contain    ${output}    ${DEFAULT_MONITORING_INTERVAL}
+    ${output} =    Issue Command On Karaf Console    ${TEP_SHOW}
+    ${tunnel_monitoring} =    Get Lines Containing String    ${output}    Tunnel Monitoring Interval
+    Should Be Equal    ${tunnel_monitoring}    ${DEFAULT_MONITORING_INTERVAL}
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_TRUE}    ${INTERFACE_DS_MONI_INT_1000}    ${TUNNEL_MONI_PROTO}
 
 BFD_TC04 Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
     [Documentation]    Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
     Wait Until Keyword Succeeds    10s    2s    Verify Tunnel Monitoring Is On
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_TRUE}    ${INTERFACE_DS_MONI_INT_1000}    ${TUNNEL_MONI_PROTO}
 
 BFD_TC04 Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
     [Documentation]    Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
     Wait Until Keyword Succeeds    10s    2s    Verify Tunnel Monitoring Is On
-    Wait Until Keyword Succeeds    10s    1s    Genius.Verify Tunnel Status as UP
+    Wait Until Keyword Succeeds    10s    1s    Genius.Verify Tunnel Status as UP    TZA
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_TRUE}    ${INTERFACE_DS_MONI_INT_1000}    ${TUNNEL_MONI_PROTO}
 
 BFD_TC05 Verify BFD tunnel monitoring interval can be changed.
     [Documentation]    Verify BFD tunnel monitoring interval can be changed.
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_TRUE}    ${INTERFACE_DS_MONI_INT_1000}    ${TUNNEL_MONI_PROTO}
 
 BFD_TC05 Verify BFD tunnel monitoring interval can be changed.
     [Documentation]    Verify BFD tunnel monitoring interval can be changed.
-    ${oper_int}    RequestsLibrary.Get Request    session    ${OPERATIONAL_API}/itm-config:tunnel-monitor-interval/
-    ${respjson}    RequestsLibrary.To Json    ${oper_int.content}    pretty_print=True
-    Log    ${respjson}
     ${oper_int}    RequestsLibrary.Put Request    session    ${CONFIG_API}/itm-config:tunnel-monitor-interval/    data=${INTERVAL_5000}
     ${Bfd_updated_value}=    Create List    5000
     Wait Until Keyword Succeeds    30s    10s    Check For Elements At Uri    ${OPERATIONAL_API}/itm-config:tunnel-monitor-interval/    ${Bfd_updated_value}
     Wait Until Keyword Succeeds    30s    10s    Check For Elements At Uri    ${CONFIG_API}/itm-config:tunnel-monitor-interval/    ${Bfd_updated_value}
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_TRUE}    ${INTERFACE_DS_MONI_INT_5000}    ${TUNNEL_MONI_PROTO}
     ${oper_int}    RequestsLibrary.Put Request    session    ${CONFIG_API}/itm-config:tunnel-monitor-interval/    data=${INTERVAL_5000}
     ${Bfd_updated_value}=    Create List    5000
     Wait Until Keyword Succeeds    30s    10s    Check For Elements At Uri    ${OPERATIONAL_API}/itm-config:tunnel-monitor-interval/    ${Bfd_updated_value}
     Wait Until Keyword Succeeds    30s    10s    Check For Elements At Uri    ${CONFIG_API}/itm-config:tunnel-monitor-interval/    ${Bfd_updated_value}
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_TRUE}    ${INTERFACE_DS_MONI_INT_5000}    ${TUNNEL_MONI_PROTO}
-    SSHLibrary.Switch Connection    ${conn_id_1}
-    Execute Command    sudo ovs-vsctl del-port ${Bridge-1} tap8ed70586-6c
-    ${ovs_1}    Execute Command    sudo ovs-vsctl show
-    log    ${ovs_1}
-    ${tun_name}    Wait Until Keyword Succeeds    20    5    Ovs Tunnel Get    ${Bridge-1}
-    Wait Until Keyword Succeeds    20s    5    OVSDB.Verify Ovs-vsctl Output    list interface ${tun_name}    5000    ovs_system=${TOOLS_SYSTEM_IP}
-    SSHLibrary.Switch Connection    ${conn_id_2}
-    ${ovs_2}    Execute Command    sudo ovs-vsctl show
-    ${tun_name}    Wait Until Keyword Succeeds    20    5    Ovs Tunnel Get    ${Bridge-2}
+    ${tun_name}    Wait Until Keyword Succeeds    20    5    Ovs Tunnel Get    ${TOOLS_SYSTEM_1_IP}
+    Wait Until Keyword Succeeds    20s    5    OVSDB.Verify Ovs-vsctl Output    list interface ${tun_name}    5000    ovs_system=${TOOLS_SYSTEM_1_IP}
+    ${tun_name}    Wait Until Keyword Succeeds    20    5    Ovs Tunnel Get    ${TOOLS_SYSTEM_2_IP}
     Wait Until Keyword Succeeds    20s    5    OVSDB.Verify Ovs-vsctl Output    list interface ${tun_name}    5000    ovs_system=${TOOLS_SYSTEM_2_IP}
 
 BFD_TC06 Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
     Wait Until Keyword Succeeds    20s    5    OVSDB.Verify Ovs-vsctl Output    list interface ${tun_name}    5000    ovs_system=${TOOLS_SYSTEM_2_IP}
 
 BFD_TC06 Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
@@ -107,7 +100,7 @@ BFD_TC06 Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
     Log    "After connecting CSS with controller"
     Issue Command On Karaf Console    ${TEP_SHOW}
     Issue Command On Karaf Console    ${TEP_SHOW_STATE}
     Log    "After connecting CSS with controller"
     Issue Command On Karaf Console    ${TEP_SHOW}
     Issue Command On Karaf Console    ${TEP_SHOW_STATE}
-    Wait Until Keyword Succeeds    10s    1s    Genius.Verify Tunnel Status as UP
+    Wait Until Keyword Succeeds    10s    1s    Genius.Verify Tunnel Status as UP    TZA
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_TRUE}    ${INTERFACE_DS_MONI_INT_5000}    ${TUNNEL_MONI_PROTO}
 
 BFD_TC07 Verify that BFD monitoring is disabled on Controller
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_TRUE}    ${INTERFACE_DS_MONI_INT_5000}    ${TUNNEL_MONI_PROTO}
 
 BFD_TC07 Verify that BFD monitoring is disabled on Controller
@@ -118,7 +111,7 @@ BFD_TC07 Verify that BFD monitoring is disabled on Controller
     ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
     Should Contain    ${output}    ${TUNNEL_MONITOR_OFF}
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_FALSE}    ${INTERFACE_DS_MONI_INT_5000}    ${TUNNEL_MONI_PROTO}
     ${output}=    Issue Command On Karaf Console    ${TEP_SHOW}
     Should Contain    ${output}    ${TUNNEL_MONITOR_OFF}
     Wait Until Keyword Succeeds    10s    2s    Verify Config Ietf Interface Output    ${INTERFACE_DS_MONI_FALSE}    ${INTERFACE_DS_MONI_INT_5000}    ${TUNNEL_MONI_PROTO}
-    Wait Until Keyword Succeeds    10s    1s    Genius.Verify Tunnel Status as UP
+    Wait Until Keyword Succeeds    10s    1s    Genius.Verify Tunnel Status as UP    TZA
     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_API}/itm-config:tunnel-monitor-params/    data=${ENABLE_MONITORING}
     Should Be Equal As Strings    ${resp.status_code}    200
     Wait Until Keyword Succeeds    10s    2s    Verify Tunnel Monitoring Params    ${TUNNEL_MONI_PARAMS_TRUE}
     ${resp}    RequestsLibrary.Put Request    session    ${CONFIG_API}/itm-config:tunnel-monitor-params/    data=${ENABLE_MONITORING}
     Should Be Equal As Strings    ${resp.status_code}    200
     Wait Until Keyword Succeeds    10s    2s    Verify Tunnel Monitoring Params    ${TUNNEL_MONI_PARAMS_TRUE}
@@ -136,9 +129,10 @@ Verify Config Ietf Interface Output
     Should Contain    ${respjson}    ${proto}
 
 Ovs Tunnel Get
     Should Contain    ${respjson}    ${proto}
 
 Ovs Tunnel Get
-    [Arguments]    ${bridge}
-    log    sudo ovs-vsctl list-ports ${bridge}
-    ${tun_name}    Execute Command    sudo ovs-vsctl list-ports ${bridge}
+    [Arguments]    ${tools_ip}
+    [Documentation]    This keyword will return the tunnel name on OVS
+    ${list_interface}    Utils.Run Command On Remote System    ${tools_ip}    sudo ovs-vsctl list interface
+    ${tun_line}    ${tun_name}    Should Match Regexp    ${list_interface}    name\\s+: "(tun.*)"
     log    ${tun_name}
     Should Not Be Empty    ${tun_name}
     [Return]    ${tun_name}
     log    ${tun_name}
     Should Not Be Empty    ${tun_name}
     [Return]    ${tun_name}