2 Documentation Functional test for bgp flowspec.
4 ... Copyright (c) 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 Library RequestsLibrary
12 Resource ../../../libraries/CompareStream.robot
13 Resource ../../../libraries/ExaBgpLib.robot
14 Resource ../../../libraries/SSHKeywords.robot
15 Resource ../../../libraries/TemplatedRequests.robot
16 Resource ../../../variables/Variables.robot
18 Suite Setup Start_Suite
19 Suite Teardown Stop_Suite
23 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpflowspec/
24 ${CMD} env exabgp.tcp.port=1790 exabgp --debug
26 ${OLD_AS_PATH} \n"as-path": {},
27 ${NEW_AS_PATH} ${EMPTY}
28 ${EXP0} {"bgp-flowspec:flowspec-routes": {}}
29 ${CFG1} bgp-flowspec.cfg
31 ${CFG2} bgp-flowspec-redirect.cfg
32 ${EXP2} bgp_flowspec_redirect
34 ... /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
35 ${CONFIG_SESSION} session
36 ${DEVICE_NAME} controller-config
37 ${RIB_INSTANCE} example-bgp-rib
38 ${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
43 Check_For_Empty_Topology_Before_Talking
44 [Documentation] Sanity check bgp-flowspec:flowspec-routes is up but empty.
46 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s Verify_Empty_Flowspec_Data
48 Reconfigure_ODL_To_Accept_Connection
49 [Documentation] Configure BGP peer module with initiate-connection set to false.
50 &{mapping} BuiltIn.Create_Dictionary
51 ... IP=${TOOLS_SYSTEM_IP}
52 ... HOLDTIME=${HOLDTIME}
53 ... PEER_PORT=${BGP_TOOL_PORT}
55 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
57 TemplatedRequests.Put_As_Xml_Templated
58 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
59 ... mapping=${mapping}
60 ... session=${CONFIG_SESSION}
63 [Documentation] Testing flowspec values for ${CFG1}
64 [Setup] Setup_Testcase ${CFG1}
65 BuiltIn.Wait_Until_Keyword_Succeeds 15s 1s Verify_Flowspec_Data ${EXP1}
66 [Teardown] ExaBgpLib.Stop_ExaBgp
69 [Documentation] Testing flowspec values for ${CFG2}
70 [Setup] Setup_Testcase ${CFG2}
71 BuiltIn.Wait_Until_Keyword_Succeeds 15s 1s Verify_Flowspec_Data ${EXP2}
72 [Teardown] ExaBgpLib.Stop_ExaBgp
74 Deconfigure_ODL_To_Accept_Connection
75 [Documentation] Deconfigure BGP peer.
76 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
77 TemplatedRequests.Delete_Templated
78 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
79 ... mapping=${mapping}
80 ... session=${CONFIG_SESSION}
85 [Documentation] Suite setup keyword
86 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=6s
87 SSHKeywords.Flexible_Mininet_Login ${TOOLS_SYSTEM_USER}
88 SSHKeywords.Virtual_Env_Create
89 SSHKeywords.Virtual_Env_Install_Package setuptools==44.0.0
90 SSHKeywords.Virtual_Env_Install_Package exabgp==3.4.16
91 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
92 Upload_Config_Files ${BGP_VARIABLES_FOLDER}
93 ${AS_PATH} CompareStream.Set_Variable_If_At_Least_Neon ${NEW_AS_PATH} ${OLD_AS_PATH}
94 BuiltIn.Set_Suite_Variable ${AS_PATH}
97 [Documentation] Suite teardown keyword
98 SSHLibrary.Close_All_Connections
99 RequestsLibrary.Delete_All_Sessions
102 [Documentation] Uploads exabgp config files
103 [Arguments] ${dir_name}
104 SSHLibrary.Put_Directory ${BGP_VARIABLES_FOLDER} .
105 @{cfgfiles} SSHLibrary.List_Files_In_Directory . *.cfg
106 FOR ${cfgfile} IN @{cfgfiles}
107 SSHLibrary.Execute_Command sed -i -e 's/EXABGPIP/${TOOLS_SYSTEM_IP}/g' ${cfgfile}
108 SSHLibrary.Execute_Command sed -i -e 's/ODLIP/${ODL_SYSTEM_IP}/g' ${cfgfile}
109 ${stdout} SSHLibrary.Execute_Command cat ${cfgfile}
114 [Arguments] ${cfg_file}
115 Verify_Empty_Flowspec_Data
116 ExaBgpLib.Start_ExaBgp_And_Verify_Connected
118 ... ${CONFIG_SESSION}
119 ... ${TOOLS_SYSTEM_IP}
120 ... connection_retries=${3}
122 Verify_Empty_Flowspec_Data
123 [Documentation] Verify expected response.
124 CompareStream.Run_Keyword_If_At_Most_Fluorine Normalize_And_Compare
125 CompareStream.Run_Keyword_If_At_Least_Neon Verify_Empty_Flowspec_Data_Neon
128 [Documentation] Verify expected response
129 [Arguments] ${exprspdir}
130 &{mapping} BuiltIn.Create_Dictionary AS_PATH=${AS_PATH}
131 TemplatedRequests.Get_As_Json_Templated
132 ... ${BGP_VARIABLES_FOLDER}${/}${exprspdir}
133 ... session=${CONFIG_SESSION}
134 ... mapping=${mapping}
137 Normalize_And_Compare
138 [Documentation] Verify empty flowspec data
139 ${rsp} RequestsLibrary.Get_Request ${CONFIG_SESSION} ${FLOWSPEC_URL}
140 TemplatedRequests.Normalize_Jsons_With_Bits_And_Compare
143 ... keys_with_bits=${EMPTY_LIST}
145 Verify_Empty_Flowspec_Data_Neon
146 [Documentation] Verify empty flowspec data on neon
147 TemplatedRequests.Get_As_Json_Templated
148 ... ${BGP_VARIABLES_FOLDER}${/}empty_route
149 ... session=${CONFIG_SESSION}