2 Documentation Basic tests for iBGP peers.
4 ... Copyright (c) 2015-2016 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 ... Test suite performs basic iBGP functional test case for
11 ... carrying LSP State Information in BGP as described in
12 ... http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03
13 Suite Setup Setup_Everything
14 Suite Teardown Teardown_Everything
15 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
16 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
17 Library OperatingSystem
18 Library RequestsLibrary
20 Variables ${CURDIR}/../../../variables/Variables.py
21 Variables ${CURDIR}/../../../variables/bgpuser/variables.py ${TOOLS_SYSTEM_IP} ${ODL_STREAM}
22 Resource ${CURDIR}/../../../libraries/BGPcliKeywords.robot
23 Resource ${CURDIR}/../../../libraries/BGPSpeaker.robot
24 Resource ${CURDIR}/../../../libraries/FailFast.robot
25 Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
26 Resource ${CURDIR}/../../../libraries/KillPythonTool.robot
27 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
28 Resource ${CURDIR}/../../../libraries/SSHKeywords.robot
29 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
30 Resource ${CURDIR}/../../../libraries/Utils.robot
31 Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
34 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpuser/
37 ${BGP_PEER_LOG_FILE} bgp_peer.log
38 ${BGP_PEER_COMMAND} python play.py --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_PEER_LOG_LEVEL} --logfile ${BGP_PEER_LOG_FILE} --bgpls True
39 ${BGP_PEER_OPTIONS} &>${BGP_PEER_LOG_FILE}
40 ${DEFAULT_RIB_CHECK_PERIOD} 1s
41 ${DEFAULT_RIB_CHECK_TIMEOUT} 10s
42 ${BGP_PEER_LOG_LEVEL} debug
43 ${CONTROLLER_LOG_LEVEL} INFO
44 ${CONTROLLER_BGP_LOG_LEVEL} DEFAULT
45 ${JSONKEYSTR} "linkstate-route"
46 ${BGP_PEER_NAME} example-bgp-peer
47 ${DEVICE_NAME} controller-config
48 ${CONFIG_SESSION} config-session
49 ${RIB_INSTANCE} example-bgp-rib
52 TC1_Configure_iBGP_Peer
53 [Documentation] Configure BGP peer module with initiate-connection set to false.
55 &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT}
56 ... INITIATE=false RIB_INSTANCE_NAME=${RIB_INSTANCE}
57 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
59 TC1_Check_Example_Bgp_Rib_Is_Empty
60 [Documentation] Check RIB for none linkstate-routes
62 SSHLibrary.Switch Connection bgp_peer_console
63 Check_Example_Bgp_Rib_Does_Not_Contain ${JSONKEYSTR}
66 [Documentation] Connect BGP peer with advertising the routes without mandatory params like LOC_PREF.
68 SSHLibrary.Switch Connection bgp_peer_console
69 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${BGP_PEER_OPTIONS}
70 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
72 TC1_Check_Example_Bgp_Rib
73 [Documentation] Check RIB for linkstate-route(s)
75 KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
76 SSHLibrary.Switch Connection bgp_peer_console
77 BuiltIn.Wait_Until_Keyword_Succeeds ${DEFAULT_RIB_CHECK_TIMEOUT} ${DEFAULT_RIB_CHECK_PERIOD} Check_Example_Bgp_Rib_Content ${JSONKEYSTR}
79 TC1_Disconnect_BGP_Peer
80 [Documentation] Stop BGP peer & store logs
82 SSHLibrary.Switch Connection bgp_peer_console
83 BGPcliKeywords.Stop_Console_Tool
84 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc1_${BGP_PEER_LOG_FILE}
86 TC1_Deconfigure_iBGP_Peer
87 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
88 KarafKeywords.Log_Testcase_Start_To_Controller_Karaf
89 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME}
90 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
94 [Documentation] SSH-login to mininet machine, create HTTP session,
95 ... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
96 SetupUtils.Setup_Utils_For_Setup_And_Teardown
97 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
98 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} alias=bgp_peer_console
99 Utils.Flexible_Mininet_Login
100 SSHKeywords.Require_Python
101 SSHKeywords.Assure_Library_Ipaddr target_dir=.
102 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
103 RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_API} auth=${AUTH}
104 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
105 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_LOG_LEVEL}
106 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.bgpcep
107 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.protocol
110 [Documentation] Create and Log the diff between expected and actual responses, make sure Python tool was killed.
111 ... Tear down imported Resources.
112 KillPythonTool.Search_And_Kill_Remote_Python 'play\.py'
113 RequestsLibrary.Delete_All_Sessions
114 SSHLibrary.Close_All_Connections
116 Check_Example_Bgp_Rib_Content
117 [Arguments] ${substr} ${error_message}=${JSONKEYSTR} not found, but expected.
118 [Documentation] Check the example-bgp-rib content for string
119 ${response}= RequestsLibrary.Get Request operational bgp-rib:bgp-rib/rib/example-bgp-rib
120 BuiltIn.Log ${response.status_code}
121 BuiltIn.Log ${response.text}
122 BuiltIn.Should_Contain ${response.text} ${substr} ${error_message} values=False
124 Check_Example_Bgp_Rib_Does_Not_Contain
125 [Arguments] ${substr} ${error_message}=${JSONKEYSTR} found, but not expected.
126 [Documentation] Check the example-bgp-rib does not contain the string
127 ${response}= RequestsLibrary.Get Request operational bgp-rib:bgp-rib/rib/example-bgp-rib
128 BuiltIn.Log ${response.status_code}
129 BuiltIn.Log ${response.text}
130 BuiltIn.Should_Not_Contain ${response.text} ${substr} ${error_message} values=False