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
14 Suite Setup Setup_Everything
15 Suite Teardown Teardown_Everything
16 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
17 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
18 Library OperatingSystem
19 Library RequestsLibrary
21 Variables ${CURDIR}/../../../variables/Variables.py
22 Variables ${CURDIR}/../../../variables/bgpuser/variables.py ${ODL_SYSTEM_PROMPT}
23 Resource ${CURDIR}/../../../libraries/BGPcliKeywords.robot
24 Resource ${CURDIR}/../../../libraries/BGPSpeaker.robot
25 Resource ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
26 Resource ${CURDIR}/../../../libraries/FailFast.robot
27 Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
28 Resource ${CURDIR}/../../../libraries/KillPythonTool.robot
29 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
30 Resource ${CURDIR}/../../../libraries/SSHKeywords.robot
31 Resource ${CURDIR}/../../../libraries/Utils.robot
32 Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
35 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpuser/
38 ${BGP_PEER_LOG_FILE} bgp_peer.log
39 ${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
40 ${BGP_PEER_OPTIONS} &>${BGP_PEER_LOG_FILE}
41 ${DEFAULT_RIB_CHECK_PERIOD} 1s
42 ${DEFAULT_RIB_CHECK_TIMEOUT} 10s
43 ${BGP_PEER_LOG_LEVEL} debug
44 ${CONTROLLER_LOG_LEVEL} INFO
45 ${CONTROLLER_BGP_LOG_LEVEL} DEFAULT
48 TC1_Configure_iBGP_Peer
50 [Documentation] Configure BGP peer module with initiate-connection set to false.
51 ${template_as_string}= BuiltIn.Set_Variable {'NAME': 'example-bgp-peer', 'IP': '${TOOLS_SYSTEM_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}', 'INITIATE': 'false'}
52 ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf ${BGP_VARIABLES_FOLDER}${/}bgp_peer ${template_as_string}
54 TC1_Check_Example_Bgp_Rib_Is_Empty
55 [Documentation] Check RIB for none linkstate-routes
57 SSHLibrary.Switch Connection bgp_peer_console
58 Check_Example_Bgp_Rib_Does_Not_Contain "bgp-linkstate:linkstate-routes": {.+}
61 [Documentation] Connect BGP peer
63 SSHLibrary.Switch Connection bgp_peer_console
64 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${BGP_PEER_OPTIONS}
65 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
67 TC1_Check_Example_Bgp_Rib
68 [Documentation] Check RIB for linkstate-route(s)
70 SSHLibrary.Switch Connection bgp_peer_console
71 BuiltIn.Wait_Until_Keyword_Succeeds ${DEFAULT_RIB_CHECK_TIMEOUT} ${DEFAULT_RIB_CHECK_PERIOD} Check_Example_Bgp_Rib_Content "bgp-linkstate:linkstate-routes": {.+}
73 TC1_Disconnect_BGP_Peer
74 [Documentation] Stop BGP peer & store logs
76 SSHLibrary.Switch Connection bgp_peer_console
77 BGPcliKeywords.Stop_Console_Tool
78 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc1_${BGP_PEER_LOG_FILE}
82 [Documentation] SSH-login to mininet machine, create HTTP session,
83 ... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
84 SetupUtils.Setup_Utils_For_Setup_And_Teardown
85 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
86 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} alias=bgp_peer_console
87 Utils.Flexible_Mininet_Login
88 SSHKeywords.Require_Python
89 SSHKeywords.Assure_Library_Ipaddr target_dir=.
90 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
91 RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_API} auth=${AUTH}
92 ConfigViaRestconf.Setup_Config_Via_Restconf
93 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_LOG_LEVEL}
94 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.bgpcep
95 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.protocol
98 [Documentation] Create and Log the diff between expected and actual responses, make sure Python tool was killed.
99 ... Tear down imported Resources.
100 KillPythonTool.Search_And_Kill_Remote_Python 'play\.py'
101 ConfigViaRestconf.Teardown_Config_Via_Restconf
102 RequestsLibrary.Delete_All_Sessions
103 SSHLibrary.Close_All_Connections
105 Check_Example_Bgp_Rib_Content
106 [Arguments] ${pattern} ${error_message}=Expected pattern not found.
107 [Documentation] Check the example-bgp-rib content for string
108 ${response}= RequestsLibrary.Get Request operational bgp-rib:bgp-rib/rib/example-bgp-rib
109 BuiltIn.Log ${response.status_code}
110 BuiltIn.Log ${response.text}
111 BuiltIn.Should_Match_Regexp ${response.text} ${pattern} ${error_message} values=False
113 Check_Example_Bgp_Rib_Does_Not_Contain
114 [Arguments] ${pattern} ${error_message}=Unexpected pattern found.
115 [Documentation] Check the example-bgp-rib does not contain the string
116 ${response}= RequestsLibrary.Get Request operational bgp-rib:bgp-rib/rib/example-bgp-rib
117 BuiltIn.Log ${response.status_code}
118 BuiltIn.Log ${response.text}
119 BuiltIn.Should_Not_Match_Regexp ${response.text} ${pattern} ${error_message} values=False