... terms of the Eclipse Public License v1.0 which accompanies this distribution,
... and is available at http://www.eclipse.org/legal/epl-v10.html
...
+... TODO: Rename this file after Beryllium is out, for example to basic.robot
+...
... Test suite performs basic BGP functional test cases:
... BGP peer initiated coonection
... - introduce and check 3 prefixes in one update message
Library OperatingSystem
Library SSHLibrary timeout=10s
Library RequestsLibrary
-Library ${CURDIR}/../../../libraries/HsfJson/hsf_json.py
+Library ${CURDIR}/../../../libraries/norm_json.py
Variables ${CURDIR}/../../../variables/Variables.py
-Variables ${CURDIR}/../../../variables/bgpuser/variables.py ${TOOLS_SYSTEM_IP}
+Variables ${CURDIR}/../../../variables/bgpuser/variables.py ${TOOLS_SYSTEM_IP} ${ODL_STREAM}
+Resource ${CURDIR}/../../../libraries/BGPcliKeywords.robot
Resource ${CURDIR}/../../../libraries/BGPSpeaker.robot
-Resource ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
Resource ${CURDIR}/../../../libraries/FailFast.robot
-Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
Resource ${CURDIR}/../../../libraries/KillPythonTool.robot
Resource ${CURDIR}/../../../libraries/SetupUtils.robot
Resource ${CURDIR}/../../../libraries/SSHKeywords.robot
+Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
${TOOLS_SYSTEM_PROMPT} ${DEFAULT_LINUX_PROMPT}
${HOLDTIME} 180
${BGP_TOOL_LOG_LEVEL} info
-${CONTROLLER_LOG_LEVEL} INFO
-${CONTROLLER_BGP_LOG_LEVEL} DEFAULT
+${ODL_LOG_LEVEL} INFO
+${ODL_BGP_LOG_LEVEL} DEFAULT
+${CONFIG_SESSION} session
+${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
+${DEVICE_NAME} controller-config
+${BGP_PEER_NAME} example-bgp-peer
+${RIB_INSTANCE} example-bgp-rib
*** Test Cases ***
Check_For_Empty_Topology_Before_Talking
Reconfigure_ODL_To_Accept_Connection
[Documentation] Configure BGP peer module with initiate-connection set to false.
- ${template_as_string}= BuiltIn.Set_Variable {'NAME': 'example-bgp-peer', 'IP': '${TOOLS_SYSTEM_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}', 'INITIATE': 'false'}
- ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf ${BGP_VARIABLES_FOLDER}${/}bgp_peer ${template_as_string}
+ &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT}
+ ... INITIATE=false BGP_RIB=${RIB_INSTANCE} PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG} RIB_INSTANCE_NAME=${RIB_INSTANCE}
+ TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
+ [Teardown] SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
Start_Talking_BGP_speaker
[Documentation] Start Python speaker to connect to ODL, verify that the tool does not promptly exit.
Reconfigure_ODL_To_Initiate_Connection
[Documentation] Replace BGP peer config module, now with initiate-connection set to true.
- ${template_as_string}= BuiltIn.Set_Variable {'NAME': 'example-bgp-peer', 'IP': '${TOOLS_SYSTEM_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}', 'INITIATE': 'true'}
- ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf ${BGP_VARIABLES_FOLDER}${/}bgp_peer ${template_as_string}
+ &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT}
+ ... INITIATE=true BGP_RIB=${RIB_INSTANCE} PASSIVE_MODE=false BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG} RIB_INSTANCE_NAME=${RIB_INSTANCE}
+ TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
Check_Listening_Connection_Is_Established
[Documentation] See TCP (BGP) connection in established state.
Delete_Bgp_Peer_Configuration
[Documentation] Revert the BGP configuration to the original state: without any configured peers.
- ${template_as_string}= BuiltIn.Set_Variable {'NAME': 'example-bgp-peer'}
- ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf ${BGP_VARIABLES_FOLDER}${/}bgp_peer ${template_as_string}
+ &{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_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
# TODO: Do we need to check something else?
*** Keywords ***
Setup_Everything
- [Documentation] SSH-login to mininet machine, create HTTP session,
+ [Documentation] Initialize SetupUtils. SSH-login to mininet machine, create HTTP session,
... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
SetupUtils.Setup_Utils_For_Setup_And_Teardown
SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
- SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
- Utils.Flexible_Mininet_Login
RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_TOPO_API} auth=${AUTH}
# TODO: Do not include slash in ${OPERATIONAL_TOPO_API}, having it typed here is more readable.
# TODO: Alternatively, create variable in Variables which starts with http.
# The previous suite may have been using the same directories.
OperatingSystem.Create_Directory ${EXPECTED_RESPONSES_FOLDER}
OperatingSystem.Create_Directory ${ACTUAL_RESPONSES_FOLDER}
+ SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
+ SSHKeywords.Flexible_Mininet_Login
+ SSHKeywords.Require_Python
+ SSHKeywords.Assure_Library_Ipaddr target_dir=.
SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
- ConfigViaRestconf.Setup_Config_Via_Restconf
- KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_LOG_LEVEL}
- KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.bgpcep
- KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.protocol
+ RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
+ KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${ODL_LOG_LEVEL}
+ KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.bgpcep
+ KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.protocol
Teardown_Everything
[Documentation] Create and Log the diff between expected and actual responses, make sure Python tool was killed.
${diff}= OperatingSystem.Run diff -dur ${EXPECTED_RESPONSES_FOLDER} ${ACTUAL_RESPONSES_FOLDER}
BuiltIn.Log ${diff}
KillPythonTool.Search_And_Kill_Remote_Python 'play\.py'
- ConfigViaRestconf.Teardown_Config_Via_Restconf
RequestsLibrary.Delete_All_Sessions
SSHLibrary.Close_All_Connections
Normalize_And_Save_Expected_Json
[Arguments] ${json_text} ${filename} ${directory}
- [Documentation] Normalize given json using hsf_json library. Log and save the result to given filename under given directory.
- ${json_normalized}= hsf_json.Hsf_Json ${json_text}
+ [Documentation] Normalize given json using norm_json library. Log and save the result to given filename under given directory.
+ ${json_normalized}= norm_json.normalize_json_text ${json_text}
BuiltIn.Log ${json_normalized}
OperatingSystem.Create_File ${directory}${/}${filename} ${json_normalized}
# TODO: Should we prepend .json to the filename? When we detect it is not already prepended?
[Documentation] Run netstat in mininet machine and parse it for number of established connections. Check it is ${howmany}.
${output}= SSHKeywords.Count_Port_Occurences 17900 ESTABLISHED python
BuiltIn.Should_Be_Equal_As_Strings ${output} ${howmany}
-
-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.
- ${passed}= BuiltIn.Run_Keyword_And_Return_Status BuiltIn.Run_Keyword_And_Expect_Error No match found for '${TOOLS_SYSTEM_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}