Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / bgpcep / bgpfunct / 040_bgp_functional_route_ref.robot
index 8ccab4586021c689025cd04b7973b04060ccd338..c72121ac03ade9a3c292a7e34351779ffeac3362 100644 (file)
@@ -7,92 +7,99 @@ Documentation     Functional test for bgp - route refresh
 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
 ...
 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
 ...
-...               This suite tests sending and receiveing route request message.
+...               This suite tests sending and receiveing route refresh message.
 ...               It uses odl and exabgp as bgp peers.
 ...               Sending route refresh message from odl is initiated via restconf.
 ...               It uses odl and exabgp as bgp peers.
 ...               Sending route refresh message from odl is initiated via restconf.
-...               If route refresh received by odl also correct advertising of routes
+...               If route refresh is received by odl, correct advertising of routes
 ...               is verified. Receiving of route refresh by odl is verified by
 ...               is verified. Receiving of route refresh by odl is verified by
-...               checking appropriate message counter via ${JOLOKURL}. Feature
-...               odl-jolokia is required by this test suite.
+...               checking appropriate message counter via odl-bgpcep-bgp-cli and
+...               restconf using BGP neighbor operational state
 Suite Setup       Start_Suite
 Suite Teardown    Stop_Suite
 Suite Setup       Start_Suite
 Suite Teardown    Stop_Suite
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Library           RequestsLibrary
 Library           SSHLibrary
 Library           RequestsLibrary
 Library           SSHLibrary
-Variables         ${CURDIR}/../../../variables/Variables.py
-Resource          ${CURDIR}/../../../libraries/Utils.robot
-Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
-Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
-Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
-Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
-Library           ${CURDIR}/../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
+Library           String
+Library           ../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
+Resource          ../../../libraries/CompareStream.robot
+Resource          ../../../libraries/ExaBgpLib.robot
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/SetupUtils.robot
+Resource          ../../../libraries/SSHKeywords.robot
+Resource          ../../../libraries/TemplatedRequests.robot
+Resource          ../../../variables/Variables.robot
 
 *** Variables ***
 
 *** Variables ***
-${HOLDTIME}       180
-${DEVICE_NAME}    controller-config
-${BGP_PEER_NAME}    example-bgp-peer
-${RIB_INSTANCE}    example-bgp-rib
 ${APP_PEER_NAME}    example-bgp-peer-app
 ${APP_PEER_NAME}    example-bgp-peer-app
-${CMD}            env exabgp.tcp.port=1790 exabgp --debug
-${BGP_VAR_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional
-${BGP_RR_VAR_FOLDER}    ${BGP_VAR_FOLDER}/route_refresh
 ${BGP_CFG_NAME}    exa.cfg
 ${BGP_CFG_NAME}    exa.cfg
+${BGP_PEER_NAME}    example-bgp-peer
+${BGP_RR_VAR_FOLDER}    ${BGP_VAR_FOLDER}/route_refresh
+${BGP_VAR_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional
 ${CONFIG_SESSION}    config-session
 ${CONFIG_SESSION}    config-session
+${DEVICE_NAME}    controller-config
 ${EXARPCSCRIPT}    ${CURDIR}/../../../../tools/exabgp_files/exarpc.py
 ${EXARPCSCRIPT}    ${CURDIR}/../../../../tools/exabgp_files/exarpc.py
-${JOLOKURL}       /jolokia/read/org.opendaylight.controller:instanceName=${BGP_PEER_NAME},type=RuntimeBean,moduleFactoryName=bgp-peer
-${PEER_CHECK_URL}    /restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/peer/bgp:%2F%2F
+${HOLDTIME}       180
+${PROTOCOL_OPENCONFIG}    ${RIB_INSTANCE}
+${RIB_INSTANCE}    example-bgp-rib
+${MSG_STATE_OFFSET}    24
 
 *** Test Cases ***
 Configure_App_Peer
 
 *** Test Cases ***
 Configure_App_Peer
-    [Documentation]    Configure bgp application peer
-    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
-    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    APP_PEER_NAME=${APP_PEER_NAME}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    APP_PEER_ID=${ODL_SYSTEM_IP}
+    [Documentation]    Configures bgp application peer. Openconfig is used for carbon and above.
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    APP_PEER_NAME=${APP_PEER_NAME}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    APP_PEER_ID=${ODL_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
+    ...    IP=${ODL_SYSTEM_IP}
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/app_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Reconfigure_ODL_To_Accept_Connection
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/app_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Reconfigure_ODL_To_Accept_Connection
-    [Documentation]    Configure BGP peer module with initiate-connection set to false.
-    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
+    [Documentation]    Configures BGP peer module with initiate-connection set to false.
     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
-    ...    INITIATE=false    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    ...    INITIATE=false    RIB_INSTANCE_NAME=${RIB_INSTANCE}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    PASSIVE_MODE=true
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
-Exa_To_Send_Route_Request
+Exa_To_Send_Route_Refresh
     [Documentation]    Exabgp sends route refresh and count received updates
     [Documentation]    Exabgp sends route refresh and count received updates
-    [Setup]    Configure_Routes_And_Start_Tool    ${BGP_CFG_NAME}
-    Verify_Odl_Received_Route_Request    0
+    [Tags]    critical
+    [Setup]    Configure_Routes_And_Start_ExaBgp    ${BGP_CFG_NAME}
     BgpRpcClient.exa_clean_received_update_count
     BgpRpcClient.exa_announce    announce route-refresh ipv4 unicast
     BgpRpcClient.exa_clean_received_update_count
     BgpRpcClient.exa_announce    announce route-refresh ipv4 unicast
-    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_Odl_Received_Route_Request    1
-    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_Tool_Received_Updates    ${nr_configured_routes}
-    [Teardown]    Deconfigure_Routes_And_Stop_Tool
-
-Odl_To_Send_Route_Request
-    [Documentation]    Sends route requests and checks if exabgp receives it
-    [Setup]    Start_Tool_And_Verify_Connected    ${BGP_CFG_NAME}
+    Comment    From neon onwards there are extra BGP End-Of-RIB message
+    ${update_count}    CompareStream.Set_Variable_If_At_Most_Fluorine    2    3
+    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_ExaBgp_Received_Updates    ${update_count}
+    Comment    From neon onwards there are extra BGP End-Of-RIB message per address family
+    ${update_count}    CompareStream.Set_Variable_If_At_Most_Fluorine    4    7
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Operational_State_Count    notification_count=0    update_count=${update_count}    receive_count=2
+    [Teardown]    Deconfigure_Routes_And_Stop_ExaBgp
+
+Odl_To_Send_Route_Refresh
+    [Documentation]    Sends route refresh request and checks if exabgp receives it
+    [Tags]    critical
+    [Setup]    ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${BGP_CFG_NAME}    ${CONFIG_SESSION}    ${TOOLS_SYSTEM_IP}
     BgpRpcClient.exa_clean_received_route_refresh_count
     &{mapping}    BuiltIn.Create_Dictionary    BGP_PEER_IP=${TOOLS_SYSTEM_IP}
     TemplatedRequests.Post_As_Xml_Templated    ${BGP_VAR_FOLDER}/route_refresh    mapping=${mapping}    session=${CONFIG_SESSION}
     BgpRpcClient.exa_clean_received_route_refresh_count
     &{mapping}    BuiltIn.Create_Dictionary    BGP_PEER_IP=${TOOLS_SYSTEM_IP}
     TemplatedRequests.Post_As_Xml_Templated    ${BGP_VAR_FOLDER}/route_refresh    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_Odl_Sent_Route_Request    1
-    [Teardown]    Stop_Tool
+    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_ExaBgp_Received_Route_Refresh    1
+    Comment    From neon onwards there are extra BGP End-Of-RIB message per address family
+    ${update_count} =    CompareStream.Set_Variable_If_At_Most_Fluorine    4    9
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Operational_State_Count    notification_count=1    update_count=${update_count}    receive_count=4
+    [Teardown]    ExaBgpLib.Stop_ExaBgp
 
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
 
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
-    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
-    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Deconfigure_App_Peer
     [Documentation]    Revert the BGP configuration to the original state: without application peer
     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Deconfigure_App_Peer
     [Documentation]    Revert the BGP configuration to the original state: without application peer
-    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
-    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    APP_PEER_NAME=${APP_PEER_NAME}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    APP_PEER_NAME=${APP_PEER_NAME}    IP=${ODL_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/app_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 *** Keywords ***
 Start_Suite
     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/app_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
 *** Keywords ***
 Start_Suite
-    [Documentation]    Suite setup keyword
+    [Documentation]    Suite setup keyword.
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
     ${mininet_conn_id}=    SSHLibrary.Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=6s
     Builtin.Set_Suite_Variable    ${mininet_conn_id}
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
     ${mininet_conn_id}=    SSHLibrary.Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=6s
     Builtin.Set_Suite_Variable    ${mininet_conn_id}
-    Utils.Flexible_Mininet_Login    ${TOOLS_SYSTEM_USER}
+    SSHKeywords.Flexible_Mininet_Login    ${TOOLS_SYSTEM_USER}
     SSHKeywords.Virtual_Env_Create
     SSHKeywords.Virtual_Env_Install_Package    exabgp==3.4.16
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
     SSHKeywords.Virtual_Env_Create
     SSHKeywords.Virtual_Env_Install_Package    exabgp==3.4.16
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
@@ -109,80 +116,71 @@ Upload_Config_Files
     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${BGP_CFG_NAME}    .
     SSHLibrary.Put_File    ${EXARPCSCRIPT}    .
     @{cfgfiles}=    SSHLibrary.List_Files_In_Directory    .    *.cfg
     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${BGP_CFG_NAME}    .
     SSHLibrary.Put_File    ${EXARPCSCRIPT}    .
     @{cfgfiles}=    SSHLibrary.List_Files_In_Directory    .    *.cfg
-    : FOR    ${cfgfile}    IN    @{cfgfiles}
-    \    SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${TOOLS_SYSTEM_IP}/g' ${cfgfile}
-    \    SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${ODL_SYSTEM_IP}/g' ${cfgfile}
-    \    SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/enable/g' ${cfgfile}
-    \    SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
-    \    ${stdout}=    SSHLibrary.Execute_Command    cat ${cfgfile}
-    \    Log    ${stdout}
-
-Start_Tool
-    [Arguments]    ${cfg_file}    ${mapping}={}
-    [Documentation]    Start the tool ${cmd} ${cfg_file}
-    ${start_cmd}    BuiltIn.Set_Variable    ${cmd} ${cfg_file}
-    BuiltIn.Log    ${start_cmd}
-    SSHKeywords.Virtual_Env_Activate_On_Current_Session    log_output=${True}
-    ${output}=    SSHLibrary.Write    ${start_cmd}
-    BuiltIn.Log    ${output}
-
-Verify_Tools_Connection
-    [Arguments]    ${connected}=${True}
-    [Documentation]    Checks peer presence in operational datastore
-    ${exp_status_code}=    BuiltIn.Set_Variable_If    ${connected}    ${200}    ${404}
-    ${rsp}=    RequestsLibrary.Get Request    ${CONFIG_SESSION}    ${PEER_CHECK_URL}${TOOLS_SYSTEM_IP}
-    BuiltIn.Log    ${rsp.content}
-    BuiltIn.Should_Be_Equal_As_Numbers    ${exp_status_code}    ${rsp.status_code}
-
-Start_Tool_And_Verify_Connected
-    [Arguments]    ${cfg_file}
-    [Documentation]    Start the tool and verify its connection
-    KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
-    Start_Tool    ${cfg_file}
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    3s    Verify_Tools_Connection    connected=${True}
-
-Stop_Tool
-    [Documentation]    Stop the tool by sending ctrl+c
-    ${output}=    SSHLibrary.Read
-    BuiltIn.Log    ${output}
-    Utils.Write_Bare_Ctrl_C
-    ${output}=    SSHLibrary.Read_Until_Prompt
-    BuiltIn.Log    ${output}
-    SSHKeywords.Virtual_Env_Deactivate_On_Current_Session    log_output=${True}
-
-Configure_Routes_And_Start_Tool
+    FOR    ${cfgfile}    IN    @{cfgfiles}
+        SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${TOOLS_SYSTEM_IP}/g' ${cfgfile}
+        SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${ODL_SYSTEM_IP}/g' ${cfgfile}
+        SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/enable/g' ${cfgfile}
+        SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
+        ${stdout}=    SSHLibrary.Execute_Command    cat ${cfgfile}
+        Log    ${stdout}
+    END
+
+Configure_Routes_And_Start_ExaBgp
     [Arguments]    ${cfg_file}
     [Documentation]    Setup keyword for exa to odl test case
     [Arguments]    ${cfg_file}
     [Documentation]    Setup keyword for exa to odl test case
-    : FOR    ${prefix}    IN    1.1.1.1/32    2.2.2.2/32
-    \    &{mapping}    BuiltIn.Create_Dictionary    PREFIX=${prefix}
-    \    TemplatedRequests.Post_As_Xml_Templated    ${BGP_RR_VAR_FOLDER}/route    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Set_Suite_Variable    ${nr_configured_routes}    2
-    Start_Tool_And_Verify_Connected    ${cfg_file}
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    3s    Verify_Tool_Received_Updates    ${nr_configured_routes}
-
-Deconfigure_Routes_And_Stop_Tool
+    ${app_rib}    Set Variable    ${ODL_SYSTEM_IP}
+    FOR    ${prefix}    IN    1.1.1.1/32    2.2.2.2/32
+        &{mapping}    BuiltIn.Create_Dictionary    PREFIX=${prefix}    APP_RIB=${app_rib}
+        TemplatedRequests.Post_As_Xml_Templated    ${BGP_RR_VAR_FOLDER}/route    mapping=${mapping}    session=${CONFIG_SESSION}
+    END
+    ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cfg_file}    ${CONFIG_SESSION}    ${TOOLS_SYSTEM_IP}
+    Comment    From neon onwards there are extra BGP End-Of-RIB message per address family
+    ${update_count}    CompareStream.Set_Variable_If_At_Most_Fluorine    2    4
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    3s    Verify_ExaBgp_Received_Updates    ${update_count}
+
+Deconfigure_Routes_And_Stop_ExaBgp
     [Documentation]    Teardown keyword for exa to odl test case
     [Documentation]    Teardown keyword for exa to odl test case
-    Stop_Tool
-    &{mapping}    BuiltIn.Create_Dictionary    PREFIX=${prefix}
+    ExaBgpLib.Stop_ExaBgp
+    ${app_rib}    Set Variable    ${ODL_SYSTEM_IP}
+    &{mapping}    BuiltIn.Create_Dictionary    PREFIX=${prefix}    APP_RIB=${app_rib}
     TemplatedRequests.Delete_Templated    ${BGP_RR_VAR_FOLDER}/route    mapping=${mapping}    session=${CONFIG_SESSION}
 
     TemplatedRequests.Delete_Templated    ${BGP_RR_VAR_FOLDER}/route    mapping=${mapping}    session=${CONFIG_SESSION}
 
-Verify_Odl_Sent_Route_Request
+Verify_ExaBgp_Received_Updates
+    [Arguments]    ${expcount}
+    [Documentation]    Gets number of received update requests and compares with given expected count
+    ${count_recv}=    BgpRpcClient.exa_get_received_update_count
+    BuiltIn.Should Be Equal As Numbers    ${count_recv}    ${expcount}
+
+Verify_ExaBgp_Received_Route_Refresh
     [Arguments]    ${expcount}
     [Documentation]    Compares expected count of route request messages on exabgp side
     ${count}=    BgpRpcClient.exa_get_received_route_refresh_count
     BuiltIn.Should Be Equal As Numbers    ${count}    ${expcount}
 
     [Arguments]    ${expcount}
     [Documentation]    Compares expected count of route request messages on exabgp side
     ${count}=    BgpRpcClient.exa_get_received_route_refresh_count
     BuiltIn.Should Be Equal As Numbers    ${count}    ${expcount}
 
-Verify_Odl_Received_Route_Request
-    [Arguments]    ${expcount}
-    [Documentation]    Gets numebr of received route requests and compares with given expected count
-    ${rsp}=    RequestsLibrary.Get_Request    ${CONFIG_SESSION}    ${JOLOKURL}
-    BuiltIn.Log    ${rsp.content}
-    BuiltIn.Should_Be_Equal_As_Numbers    ${rsp.status_code}    200
-    BuiltIn.Should_Be_Equal_As_Numbers    ${rsp.json()['status']}    200
-    BuiltIn.Should_Be_Equal_As_Numbers    ${rsp.json()['value']['BgpSessionState']['messagesStats']['routeRefreshMsgs']['received']['count']['value']}    ${expcount}
-
-Verify_Tool_Received_Updates
-    [Arguments]    ${expcount}
-    [Documentation]    Gets numebr of received update requests and compares with given expected count
-    ${count_recv}=    BgpRpcClient.exa_get_received_update_count
-    BuiltIn.Should Be Equal As Numbers    ${count_recv}    ${expcount}
+Verify_Odl_Operational_State_Count
+    [Arguments]    ${notification_count}    ${update_count}    ${receive_count}
+    [Documentation]    Check notification and update count gained from operatial neighbor state
+    ...    On versions oxygen and above, it verifies these counts also against cli output.
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    NOT_COUNT=${notification_count}    SEND_COUNT=${update_count}    RECV_COUNT=${receive_count}
+    ${ret}=    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    TemplatedRequests.Get_As_Json_Templated    folder=${BGP_RR_VAR_FOLDER}/operational_state    mapping=${mapping}
+    ...    session=${CONFIG_SESSION}    verify=True
+    BuiltIn.Log    ${ret}
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Cli_Output_Count    ${notification_count}    ${update_count}    ${receive_count}
+
+Verify_Cli_Output_Count
+    [Arguments]    ${notification_count}    ${update_count}    ${receive_count}
+    [Documentation]    Checks notification and update count from odl-bgpcep-bgp-cli.
+    ...    odl-bgpcep-bgp-cli is only avaiable on versions oxygen and above.
+    ${output}    KarafKeywords.Safe_Issue_Command_On_Karaf_Console    bgp:operational-state -rib example-bgp-rib -neighbor ${TOOLS_SYSTEM_IP}
+    BuiltIn.Log    ${output}
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    NOT_COUNT=${notification_count}    SEND_COUNT=${update_count}    DIVIDER=│    RECV_COUNT=${receive_count}
+    ${expstate}    TemplatedRequests.Resolve_Text_From_Template_File    folder=${BGP_RR_VAR_FOLDER}/operational_cli    file_name=update.txt    mapping=${mapping}
+    String.Get Line Count    ${output}
+    BuiltIn.Log    ${expstate}
+    ${expected_line_count}    String.Get Line Count    ${expstate}
+    FOR    ${expected_line_pos}    IN RANGE    0    ${expected_line_count-1}
+        ${expected_line_offset}    BuiltIn.Evaluate    ${MSG_STATE_OFFSET} + ${expected_line_pos}
+        ${output_line}    String.Get Line    ${output}    ${expected_line_offset}
+        ${expected_line}    String.Get Line    ${expstate}    ${expected_line_pos}
+        BuiltIn.Should Match    ${output_line}    ${expected_line}
+    END