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 BgpOperations.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 Resource ../../../libraries/BGPcliKeywords.robot
21 Resource ../../../libraries/BgpOperations.robot
22 Resource ../../../libraries/CompareStream.robot
23 Resource ../../../libraries/KarafKeywords.robot
24 Resource ../../../libraries/SetupUtils.robot
25 Resource ../../../libraries/SSHKeywords.robot
26 Resource ../../../libraries/TemplatedRequests.robot
27 Resource ../../../libraries/WaitForFailure.robot
28 Resource ../../../variables/Variables.robot
31 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpuser/
34 ${BGP_PEER_LOG_FILE} bgp_peer.log
35 ${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
36 ${BGP_PEER_OPTIONS} &>${BGP_PEER_LOG_FILE}
37 ${DEFAULT_RIB_CHECK_PERIOD} 1s
38 ${DEFAULT_RIB_CHECK_TIMEOUT} 10s
39 ${BGP_PEER_LOG_LEVEL} debug
40 ${JSONKEYSTR} "linkstate-route"
41 ${BGP_PEER_NAME} example-bgp-peer
42 ${DEVICE_NAME} controller-config
43 ${CONFIG_SESSION} config-session
44 ${SKIP_PARAMS} --skipattr
45 ${RIB_INSTANCE} example-bgp-rib
46 ${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
47 ${OLD_ROUTE_KEY} [0, 5, 0, 21, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 0, 1, 0, 1, 5, 6, 7, 8]
48 ${NEW_ROUTE_KEY} AAUAFQcAAAAAAAAAAQECAwQAAQABBQYHCA==
51 TC1_Configure_iBGP_Peer
52 [Documentation] Configure BGP peer module with initiate-connection set to false.
54 &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT}
55 ... INITIATE=false BGP_RIB=${RIB_INSTANCE} PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG} RIB_INSTANCE_NAME=${RIB_INSTANCE}
56 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
58 TC1_Check_Example_Bgp_Rib_Is_Empty
59 [Documentation] Check RIB for none linkstate-routes
61 BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain ${CONFIG_SESSION} ${JSONKEYSTR}
64 [Documentation] Connect BGP peer with advertising the routes without mandatory params like LOC_PREF.
66 BuiltIn.Run_Keyword_And_Ignore_Error KarafKeywords.Log_Message_To_Controller_Karaf Error = WELL_KNOWN_ATTR_MISSING is EXPECTED in this test case, and should be thrown when missing mandatory attributes.
67 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${SKIP_PARAMS} ${BGP_PEER_OPTIONS}
68 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
70 TC1_Check_Example_Bgp_Rib
71 [Documentation] Check RIB for not containig linkstate-route(s), because update messages were not good.
73 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout ${DEFAULT_RIB_CHECK_TIMEOUT} ${DEFAULT_RIB_CHECK_PERIOD} BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain ${CONFIG_SESSION} ${JSONKEYSTR}
75 TC1_Disconnect_BGP_Peer
76 [Documentation] Stop BGP peer & store logs
78 BGPcliKeywords.Stop_Console_Tool
79 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc1_${BGP_PEER_LOG_FILE}
81 TC1_Deconfigure_iBGP_Peer
82 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
83 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
84 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
86 TC2_Configure_iBGP_Peer
87 [Documentation] Configures BGP peer module with initiate-connection set to false.
88 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT}
89 ... INITIATE=false RIB_INSTANCE_NAME=${RIB_INSTANCE} PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
90 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
92 TC2_Check_Example_Bgp_Rib_Is_Empty
93 [Documentation] Check RIB for none linkstate-routes
95 BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain ${CONFIG_SESSION} ${JSONKEYSTR}
98 [Documentation] Connect BGP peer
100 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${BGP_PEER_OPTIONS}
101 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
103 TC2_Check_Example_Bgp_Rib
104 [Documentation] Check RIB for linkstate-route(s) and check all of their attributes.
106 ${route_key} = CompareStream.Set_Variable_If_At_Least_Fluorine ${NEW_ROUTE_KEY} ${OLD_ROUTE_KEY}
107 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} ROUTE_KEY=${route_key}
108 BuiltIn.Wait_Until_Keyword_Succeeds ${DEFAULT_RIB_CHECK_TIMEOUT} ${DEFAULT_RIB_CHECK_PERIOD} TemplatedRequests.Get_As_Json_Templated ${BGP_VARIABLES_FOLDER}/lsp/effective_rib_in mapping=${mapping} session=${CONFIG_SESSION}
111 TC2_Disconnect_BGP_Peer
112 [Documentation] Stop BGP peer & store logs
114 BGPcliKeywords.Stop_Console_Tool
115 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc2_${BGP_PEER_LOG_FILE}
117 TC2_Deconfigure_iBGP_Peer
118 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
119 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
120 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
124 [Documentation] Initialize SetupUtils. SSH-login to mininet machine, create HTTP session,
125 ... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
126 SetupUtils.Setup_Utils_For_Setup_And_Teardown
127 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
128 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
129 SSHKeywords.Flexible_Mininet_Login
130 SSHKeywords.Require_Python
131 SSHKeywords.Assure_Library_Ipaddr target_dir=.
132 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
133 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
134 KarafKeywords.Setup_Karaf_Keywords