Library SSHLibrary
Variables ${CURDIR}/../../../variables/Variables.py
Variables ${CURDIR}/../../../variables/bgpuser/variables.py ${TOOLS_SYSTEM_IP} ${ODL_STREAM}
+Resource ${CURDIR}/../../../libraries/ExaBgpLib.robot
Resource ${CURDIR}/../../../libraries/Utils.robot
Resource ${CURDIR}/../../../libraries/SetupUtils.robot
-Resource ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
Resource ${CURDIR}/../../../libraries/CompareStream.robot
-Library ${CURDIR}/../../../libraries/norm_json.py
+Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
*** Variables ***
${HOLDTIME} 180
${CFG2} bgp-flowspec-redirect.cfg
${EXP2} bgp-flowspec-redirect.json
${FLOWSPEC_URL} /restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/loc-rib/tables/bgp-types:ipv4-address-family/bgp-flowspec:flowspec-subsequent-address-family/bgp-flowspec:flowspec-routes
+${CONFIG_SESSION} session
+${DEVICE_NAME} controller-config
+${BGP_PEER_NAME} example-bgp-peer
+${RIB_INSTANCE} example-bgp-rib
+${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
*** 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} ${template_as_string}
+ &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT}
+ ... INITIATE=false RIB_INSTANCE_NAME=${RIB_INSTANCE} BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG} PASSIVE_MODE=true
+ TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
FlowSpec Test 1
[Documentation] Testing flowspec values for ${CFG1}
[Setup] Setup Testcase ${CFG1}
BuiltIn.Wait Until Keyword Succeeds 15s 1s Verify Flowspec Data ${EXP1}
- [Teardown] Stop_Tool
+ [Teardown] ExaBgpLib.Stop_ExaBgp
FlowSpec Test 2
[Documentation] Testing flowspec values for ${CFG2}
[Setup] Setup Testcase ${CFG2}
BuiltIn.Wait Until Keyword Succeeds 15s 1s Verify Flowspec Data ${EXP2}
- [Teardown] Stop_Tool
+ [Teardown] ExaBgpLib.Stop_ExaBgp
Deconfigure_ODL_To_Accept_Connection
[Documentation] Deconfigure BGP peer.
- ${template_as_string}= BuiltIn.Set_Variable {'NAME': 'example-bgp-peer', 'IP': '${TOOLS_SYSTEM_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}', 'INITIATE': 'false'}
- ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf ${BGP_VARIABLES_FOLDER} ${template_as_string}
+ &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} 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}
*** Keywords ***
Start Suite
... return_rc=True
${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command sudo pip install exabgp return_stdout=True return_stderr=True
... return_rc=True
- RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
- ConfigViaRestconf.Setup_Config_Via_Restconf
+ RequestsLibrary.Create Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
Upload Config Files ${CURDIR}/../../../variables/bgpflowspec/
Stop Suite
[Documentation] Suite teardown keyword
- ConfigViaRestconf.Teardown_Config_Via_Restconf
SSHLibrary.Close All Connections
RequestsLibrary.Delete All Sessions
Setup Testcase
[Arguments] ${cfg_file}
Verify Empty Flowspec Data
- Start Tool ${cfg_file}
-
-Start_Tool
- [Arguments] ${cfg_file}
- [Documentation] Start the tool ${cmd} ${cfg_file}
- BuiltIn.Log ${cmd} ${cfg_file}
- ${output}= SSHLibrary.Write ${cmd} ${cfg_file}
- BuiltIn.Log ${output}
-
-Wait_Until_Tool_Finish
- [Arguments] ${timeout}
- [Documentation] Wait ${timeout} for the tool exit.
- BuiltIn.Wait Until Keyword Succeeds ${timeout} 1s SSHLibrary.Read Until Prompt
-
-Stop_Tool
- [Documentation] Stop the tool if still running.
- Utils.Write_Bare_Ctrl_C
- ${output}= SSHLibrary.Read delay=1s
- BuiltIn.Log ${output}
- Verify Empty Flowspec Data
+ ExaBgpLib.Start_ExaBgp_And_Verify_Connected ${cfg_file} ${CONFIG_SESSION} ${TOOLS_SYSTEM_IP}
Verify Empty Flowspec Data
[Documentation] Verify expected response.
${keys_with_bits}= BuiltIn.Create_List
CompareStream.Run_Keyword_If_At_Most boron Collections.Append_To_List ${keys_with_bits} op
${expected_rsp}= Get Expected Response From File ${exprspfile}
- ${expected_json}= norm_json.Normalize Json Text ${expected_rsp} keys_with_bits=${keys_with_bits}
- ${rsp}= RequestsLibrary.Get Request session ${FLOWSPEC_URL}
- BuiltIn.Log ${rsp.content}
- ${received_json}= norm_json.Normalize Json Text ${rsp.content} keys_with_bits=${keys_with_bits}
- BuiltIn.Log ${received_json}
- BuiltIn.Log ${expected_json}
- BuiltIn.Should Be Equal ${received_json} ${expected_json}
+ ${rsp}= RequestsLibrary.Get Request ${CONFIG_SESSION} ${FLOWSPEC_URL}
+ TemplatedRequests.Normalize_Jsons_With_Bits_And_Compare ${expected_rsp} ${rsp.content} keys_with_bits=${keys_with_bits}
Get Expected Response From File
[Arguments] ${exprspfile}