Variables ${CURDIR}/../../../variables/bgpuser/variables.py ${MININET}
Resource ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
Resource ${CURDIR}/../../../libraries/FailFast.robot
+Resource ${CURDIR}/../../../libraries/BGPSpeaker.robot
Resource ${CURDIR}/../../../libraries/KillPythonTool.robot
Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Reconfigure_ODL_To_Accept_Connection
[Documentation] Configure BGP peer module with initiate-connection set to false.
- ${template_as_string}= BuiltIn.Set_Variable {'IP': '${MININET}', 'HOLDTIME': '${HOLDTIME}', 'INITIATE': 'false'}
+ ${template_as_string}= BuiltIn.Set_Variable {'IP': '${MININET}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}', 'INITIATE': 'false'}
ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf ${directory_with_template_folders}${/}bgp_peer ${template_as_string}
Start_Talking_BGP_speaker
[Documentation] Start Python speaker to connect to ODL, verify that the tool does not promptly exit.
- ${command}= BuiltIn.Set_Variable python play.py --amount 2 --myip=${MININET} --myport=17900 --peerip=${CONTROLLER} --peerport=1790
# Myport value is needed for checking whether connection at precise port was established.
- # TODO: Do we want to define ${BGP_PORT} in Variables.py?
- BuiltIn.Log ${command}
- ${output}= SSHLibrary.Write ${command}
+ BGPSpeaker.Start_BGP_Speaker --amount 2 --myip=${MININET} --myport=${BGP_TOOL_PORT} --peerip=${CONTROLLER} --peerport=${ODL_BGP_PORT}
Read_And_Fail_If_Prompt_Is_Seen
Check_Talking_Connection_Is_Established
Kill_Talking_BGP_Speaker
[Documentation] Abort the Python speaker. Also, attempt to stop failing fast.
[Setup] FailFast.Run_Even_When_Failing_Fast
- Kill_BGP_Speaker
+ BGPSpeaker.Kill_BGP_Speaker
FailFast.Do_Not_Fail_Fast_From_Now_On
# NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
[Teardown] FailFast.Do_Not_Start_Failing_If_This_Failed
Start_Listening_BGP_Speaker
[Documentation] Start Python speaker in listening mode, verify that the tool does not exit quickly.
- ${command}= BuiltIn.Set_Variable python play.py --amount 2 --listen --myip=${MININET} --myport=17900 --peerip=${CONTROLLER}
- # TODO: ${BGP_TOOL_PORT} is probably not worth the trouble.
- Builtin.Log ${command}
- ${output}= SSHLibrary.Write ${command}
+ BGPSpeaker.Start_BGP_Speaker --amount 2 --listen --myip=${MININET} --myport=${BGP_TOOL_PORT} --peerip=${CONTROLLER}
Read_And_Fail_If_Prompt_Is_Seen
Check_Listening_Connection_Is_Not_Established_Yet
Reconfigure_ODL_To_Initiate_Connection
[Documentation] Replace BGP peer config module, now with initiate-connection set to true.
- ${template_as_string}= BuiltIn.Set_Variable {'IP': '${MININET}', 'HOLDTIME': '${HOLDTIME}', 'INITIATE': 'true'}
+ ${template_as_string}= BuiltIn.Set_Variable {'IP': '${MININET}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}', 'INITIATE': 'true'}
ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf ${directory_with_template_folders}${/}bgp_peer ${template_as_string}
Check_Listening_Connection_Is_Established
Kill_Listening_BGP_Speaker
[Documentation] Abort the Python speaker. Also, attempt to stop failing fast.
[Setup] FailFast.Run_Even_When_Failing_Fast
- Kill_BGP_Speaker
+ BGPSpeaker.Kill_BGP_Speaker
FailFast.Do_Not_Fail_Fast_From_Now_On
# NOTE: It is still possible to remain failing, if both previous and this test failed.
[Teardown] FailFast.Do_Not_Start_Failing_If_This_Failed
# TODO: Should we prepend .json to the filename? When we detect it is not already prepended?
[Return] ${json_normalized}
-Kill_BGP_Speaker
- [Documentation] Interrupt play.py, fail if no prompt is seen within SSHLibrary timeout.
- ... Also, check that TCP connection is no longer established.
- Write_Bare_Ctrl_C
- SSHLibrary.Read_Until_Prompt
- Check_Speaker_Is_Not_Connected
-
Check_Speaker_Is_Not_Connected
[Documentation] Give it a few tries to see zero established connections.
BuiltIn.Wait_Until_Keyword_Succeeds 3s 1s Check_Number_Of_Speaker_Connections 0
Read_And_Fail_If_Prompt_Is_Seen
[Documentation] Try to read SSH to see prompt, but expect to see no prompt within SSHLibrary's timeout.
- BuiltIn.Run_Keyword_And_Expect_Error No match found for '${prompt}' in *. Read_Text_Before_Prompt
+ ${passed}= BuiltIn.Run_Keyword_And_Return_Status BuiltIn.Run_Keyword_And_Expect_Error No match found for '${prompt}' in *. Read_Text_Before_Prompt
+ BuiltIn.Return_From_Keyword_If ${passed}
+ BGPSpeaker.Dump_BGP_Speaker_Logs
+ Builtin.Fail The prompt was seen but it was not expected yet
Read_Text_Before_Prompt
[Documentation] Log text gathered by SSHLibrary.Read_Until_Prompt.
... This needs to be a separate keyword just because how Read_And_Fail_If_Prompt_Is_Seen is implemented.
${text}= SSHLibrary.Read_Until_Prompt
BuiltIn.Log ${text}
-
-Write_Bare_Ctrl_C
- [Documentation] Construct ctrl+c character and SSH-write it (without endline). Do not read anything yet.
- # TODO: Place this keyword to some Resource so that it can be re-used in other suites.
- ${command}= BuiltIn.Evaluate chr(int(3))
- SSHLibrary.Write_Bare ${command}