Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
Library RequestsLibrary
Library SSHLibrary
-Variables ../../../variables/Variables.py
+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/TemplatedRequests.robot
Resource ../../../libraries/SSHKeywords.robot
-Resource ../../../libraries/KarafKeywords.robot
-Resource ../../../libraries/CompareStream.robot
-Library ../../../libraries/BgpRpcClient.py ${TOOLS_SYSTEM_IP}
+Resource ../../../libraries/TemplatedRequests.robot
+Resource ../../../variables/Variables.robot
*** Variables ***
-${HOLDTIME} 180
-${DEVICE_NAME} controller-config
-${BGP_PEER_NAME} example-bgp-peer
-${RIB_INSTANCE} example-bgp-rib
-${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
${APP_PEER_NAME} example-bgp-peer-app
-${BGP_VAR_FOLDER} ${CURDIR}/../../../variables/bgpfunctional
-${BGP_RR_VAR_FOLDER} ${BGP_VAR_FOLDER}/route_refresh
${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
+${DEVICE_NAME} controller-config
${EXARPCSCRIPT} ${CURDIR}/../../../../tools/exabgp_files/exarpc.py
+${HOLDTIME} 180
+${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
+${RIB_INSTANCE} example-bgp-rib
*** Test Cases ***
Configure_App_Peer
Exa_To_Send_Route_Refresh
[Documentation] Exabgp sends route refresh and count received updates
+ [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
BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s Verify_ExaBgp_Received_Updates ${nr_configured_routes}
- BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s Verify_Odl_Received_Updates ${nr_configured_routes}
+ BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s Verify_Odl_Operational_State_Count notification_count=0 update_count=${nr_configured_routes}
[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}
BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s Verify_ExaBgp_Received_Route_Refresh 1
- BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s Verify_Odl_Received_Route_Refresh 1
+ BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s Verify_Odl_Operational_State_Count notification_count=1 update_count=4
[Teardown] ExaBgpLib.Stop_ExaBgp
Delete_Bgp_Peer_Configuration
Verify_ExaBgp_Received_Updates
[Arguments] ${expcount}
[Documentation] Gets number of received update requests and compares with given expected count
- [Tags] critical
${count_recv}= BgpRpcClient.exa_get_received_update_count
BuiltIn.Should Be Equal As Numbers ${count_recv} ${expcount}
-Verify_Odl_Received_Updates
- [Arguments] ${expcount}
- [Documentation] Compares sent information with given expected count using restconf
- [Tags] critical
- &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} RIB_INSTANCE_NAME=${RIB_INSTANCE} COUNT=${expcount}
- ${ret}= BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s TemplatedRequests.Get_As_Json_Templated folder=${BGP_RR_VAR_FOLDER}/operational_updates mapping=${mapping}
- ... session=${CONFIG_SESSION} verify=True
- CompareStream.Run_Keyword_If_At_Least_Oxygen BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s Verify_Odl_Received_Updates_Cli ${expcount}
-
-Verify_Odl_Received_Updates_Cli
- [Arguments] ${expcount}
- [Documentation] Compares sent information with given expected count using odl-bgpcep-bgp-cli
- [Tags] critical
- ${output}= KarafKeywords.Safe_Issue_Command_On_Karaf_Console bgp:operational-state -rib example-bgp-rib -neighbor ${TOOLS_SYSTEM_IP}
- &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} COUNT=${expcount}
- ${expstate} TemplatedRequests.Resolve_Text_From_Template_File folder=${BGP_RR_VAR_FOLDER}/operational_cli/ file_name=update.txt mapping=${mapping}
- ${expstate_ipv4} TemplatedRequests.Resolve_Text_From_Template_File folder=${BGP_RR_VAR_FOLDER}/operational_cli/ file_name=update_ipv4.txt mapping=${mapping}
- BuiltIn.Should_Contain ${output} ${expstate}
- BuiltIn.Should_Contain ${output} ${expstate_ipv4}
-
Verify_ExaBgp_Received_Route_Refresh
[Arguments] ${expcount}
[Documentation] Compares expected count of route request messages on exabgp side
- [Tags] critical
${count}= BgpRpcClient.exa_get_received_route_refresh_count
BuiltIn.Should Be Equal As Numbers ${count} ${expcount}
-Verify_Odl_Received_Route_Refresh
- [Arguments] ${expcount}
- [Documentation] Compares expected count of messages on odl using restconf
- [Tags] critical
- &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} RIB_INSTANCE_NAME=${RIB_INSTANCE} COUNT=${expcount}
- ${ret}= BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s TemplatedRequests.Get_As_Json_Templated folder=${BGP_RR_VAR_FOLDER}/operational_route_refresh mapping=${mapping}
+Verify_Odl_Operational_State_Count
+ [Arguments] ${notification_count} ${update_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} UPD_COUNT=${update_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
- CompareStream.Run_Keyword_If_At_Least_Oxygen BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s Verify_Odl_Received_Route_Refresh_Cli ${expcount}
-
-Verify_Odl_Received_Route_Refresh_Cli
- [Arguments] ${expcount}
- [Documentation] Compares expected count of messages on odl using odl-bgpcep-bgp-cli
- [Tags] critical
- ${output}= KarafKeywords.Safe_Issue_Command_On_Karaf_Console bgp:operational-state -rib example-bgp-rib -neighbor ${TOOLS_SYSTEM_IP}
- &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} COUNT=${expcount}
- ${expstate} TemplatedRequests.Resolve_Text_From_Template_File folder=${BGP_RR_VAR_FOLDER}/operational_cli/ file_name=route_refresh.txt mapping=${mapping}
+ BuiltIn.Log ${ret}
+ CompareStream.Run_Keyword_If_At_Least_Oxygen BuiltIn.Wait_Until_Keyword_Succeeds 3x 5s Verify_Cli_Output_Count ${notification_count} ${update_count}
+
+Verify_Cli_Output_Count
+ [Arguments] ${notification_count} ${update_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}
+ # cli output in karaf has changed in fluorine with different divider between results.
+ ${divider} CompareStream.Set_Variable_If_At_Least_Fluorine │ |
+ &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} NOT_COUNT=${notification_count} UPD_COUNT=${update_count} DIVIDER=${divider}
+ ${expstate} TemplatedRequests.Resolve_Text_From_Template_File folder=${BGP_RR_VAR_FOLDER}/operational_cli file_name=update.txt mapping=${mapping}
BuiltIn.Should_Contain ${output} ${expstate}