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 ${ODL_SYSTEM_PROMPT}
22 Resource ${CURDIR}/../../../libraries/BGPcliKeywords.robot
23 Resource ${CURDIR}/../../../libraries/BGPSpeaker.robot
24 Resource ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
25 Resource ${CURDIR}/../../../libraries/FailFast.robot
26 Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
27 Resource ${CURDIR}/../../../libraries/KillPythonTool.robot
28 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
29 Resource ${CURDIR}/../../../libraries/SSHKeywords.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
47 TC1_Configure_iBGP_Peer
48 [Documentation] Configure BGP peer module with initiate-connection set to false.
50 ${template_as_string}= BuiltIn.Set_Variable {'NAME': 'example-bgp-peer', 'IP': '${TOOLS_SYSTEM_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}', 'INITIATE': 'false'}
51 ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf ${BGP_VARIABLES_FOLDER}${/}bgp_peer ${template_as_string}
53 TC1_Check_Example_Bgp_Rib_Is_Empty
54 [Documentation] Check RIB for none linkstate-routes
56 SSHLibrary.Switch Connection bgp_peer_console
57 Check_Example_Bgp_Rib_Does_Not_Contain "bgp-linkstate:linkstate-routes": {.+}
60 [Documentation] Connect BGP peer
62 SSHLibrary.Switch Connection bgp_peer_console
63 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${BGP_PEER_OPTIONS}
64 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
66 TC1_Check_Example_Bgp_Rib
67 [Documentation] Check RIB for linkstate-route(s)
69 SSHLibrary.Switch Connection bgp_peer_console
70 BuiltIn.Wait_Until_Keyword_Succeeds ${DEFAULT_RIB_CHECK_TIMEOUT} ${DEFAULT_RIB_CHECK_PERIOD} Check_Example_Bgp_Rib_Content "bgp-linkstate:linkstate-routes": {.+}
72 TC1_Disconnect_BGP_Peer
73 [Documentation] Stop BGP peer & store logs
75 SSHLibrary.Switch Connection bgp_peer_console
76 BGPcliKeywords.Stop_Console_Tool
77 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc1_${BGP_PEER_LOG_FILE}
81 [Documentation] SSH-login to mininet machine, create HTTP session,
82 ... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
83 SetupUtils.Setup_Utils_For_Setup_And_Teardown
84 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
85 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} alias=bgp_peer_console
86 Utils.Flexible_Mininet_Login
87 SSHKeywords.Require_Python
88 SSHKeywords.Assure_Library_Ipaddr target_dir=.
89 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
90 RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_API} auth=${AUTH}
91 ConfigViaRestconf.Setup_Config_Via_Restconf
92 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_LOG_LEVEL}
93 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.bgpcep
94 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.protocol
97 [Documentation] Create and Log the diff between expected and actual responses, make sure Python tool was killed.
98 ... Tear down imported Resources.
99 KillPythonTool.Search_And_Kill_Remote_Python 'play\.py'
100 ConfigViaRestconf.Teardown_Config_Via_Restconf
101 RequestsLibrary.Delete_All_Sessions
102 SSHLibrary.Close_All_Connections
104 Check_Example_Bgp_Rib_Content
105 [Arguments] ${pattern} ${error_message}=Expected pattern not found.
106 [Documentation] Check the example-bgp-rib content for string
107 ${response}= RequestsLibrary.Get Request operational bgp-rib:bgp-rib/rib/example-bgp-rib
108 BuiltIn.Log ${response.status_code}
109 BuiltIn.Log ${response.text}
110 BuiltIn.Should_Match_Regexp ${response.text} ${pattern} ${error_message} values=False
112 Check_Example_Bgp_Rib_Does_Not_Contain
113 [Arguments] ${pattern} ${error_message}=Unexpected pattern found.
114 [Documentation] Check the example-bgp-rib does not contain the string
115 ${response}= RequestsLibrary.Get Request operational bgp-rib:bgp-rib/rib/example-bgp-rib
116 BuiltIn.Log ${response.status_code}
117 BuiltIn.Log ${response.text}
118 BuiltIn.Should_Not_Match_Regexp ${response.text} ${pattern} ${error_message} values=False