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 ${EXP0} {"bgp-flowspec:flowspec-routes": {}}
27 ${CFG1} bgp-flowspec.cfg
29 ${CFG2} bgp-flowspec-redirect.cfg
30 ${EXP2} bgp_flowspec_redirect
32 ... /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
33 ${CONFIG_SESSION} session
34 ${DEVICE_NAME} controller-config
35 ${RIB_INSTANCE} example-bgp-rib
36 ${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
41 Check_For_Empty_Topology_Before_Talking
42 [Documentation] Sanity check bgp-flowspec:flowspec-routes is up but empty.
44 BuiltIn.Wait_Until_Keyword_Succeeds 60s 3s Verify_Empty_Flowspec_Data
46 Reconfigure_ODL_To_Accept_Connection
47 [Documentation] Configure BGP peer module with initiate-connection set to false.
48 &{mapping} BuiltIn.Create_Dictionary
49 ... IP=${TOOLS_SYSTEM_IP}
50 ... HOLDTIME=${HOLDTIME}
51 ... PEER_PORT=${BGP_TOOL_PORT}
53 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
55 TemplatedRequests.Put_As_Xml_Templated
56 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
57 ... mapping=${mapping}
58 ... session=${CONFIG_SESSION}
61 [Documentation] Testing flowspec values for ${CFG1}
62 [Setup] Setup_Testcase ${CFG1}
63 BuiltIn.Wait_Until_Keyword_Succeeds 15s 1s Verify_Flowspec_Data ${EXP1}
64 [Teardown] ExaBgpLib.Stop_ExaBgp
67 [Documentation] Testing flowspec values for ${CFG2}
68 [Setup] Setup_Testcase ${CFG2}
69 BuiltIn.Wait_Until_Keyword_Succeeds 15s 1s Verify_Flowspec_Data ${EXP2}
70 [Teardown] ExaBgpLib.Stop_ExaBgp
72 Deconfigure_ODL_To_Accept_Connection
73 [Documentation] Deconfigure BGP peer.
74 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
75 TemplatedRequests.Delete_Templated
76 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
77 ... mapping=${mapping}
78 ... session=${CONFIG_SESSION}
83 [Documentation] Suite setup keyword
84 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=6s
85 SSHKeywords.Flexible_Mininet_Login ${TOOLS_SYSTEM_USER}
86 SSHKeywords.Virtual_Env_Create
87 SSHKeywords.Virtual_Env_Install_Package setuptools==44.0.0
88 SSHKeywords.Virtual_Env_Install_Package exabgp==3.4.16
89 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
90 Upload_Config_Files ${BGP_VARIABLES_FOLDER}
93 [Documentation] Suite teardown keyword
94 SSHLibrary.Close_All_Connections
95 RequestsLibrary.Delete_All_Sessions
98 [Documentation] Uploads exabgp config files
99 [Arguments] ${dir_name}
100 SSHLibrary.Put_Directory ${BGP_VARIABLES_FOLDER} .
101 @{cfgfiles} SSHLibrary.List_Files_In_Directory . *.cfg
102 FOR ${cfgfile} IN @{cfgfiles}
103 SSHLibrary.Execute_Command sed -i -e 's/EXABGPIP/${TOOLS_SYSTEM_IP}/g' ${cfgfile}
104 SSHLibrary.Execute_Command sed -i -e 's/ODLIP/${ODL_SYSTEM_IP}/g' ${cfgfile}
105 ${stdout} SSHLibrary.Execute_Command cat ${cfgfile}
110 [Arguments] ${cfg_file}
111 Verify_Empty_Flowspec_Data
112 ExaBgpLib.Start_ExaBgp_And_Verify_Connected
114 ... ${CONFIG_SESSION}
115 ... ${TOOLS_SYSTEM_IP}
116 ... connection_retries=${3}
118 Verify_Empty_Flowspec_Data
119 [Documentation] Verify expected response.
120 Verify_Empty_Flowspec_Data_Neon
123 [Documentation] Verify expected response
124 [Arguments] ${exprspdir}
125 TemplatedRequests.Get_As_Json_Templated
126 ... ${BGP_VARIABLES_FOLDER}${/}${exprspdir}
127 ... session=${CONFIG_SESSION}
130 Normalize_And_Compare
131 [Documentation] Verify empty flowspec data
132 ${rsp} RequestsLibrary.GET On Session ${CONFIG_SESSION} url=${FLOWSPEC_URL}
133 TemplatedRequests.Normalize_Jsons_With_Bits_And_Compare
136 ... keys_with_bits=${EMPTY_LIST}
138 Verify_Empty_Flowspec_Data_Neon
139 [Documentation] Verify empty flowspec data on neon
140 TemplatedRequests.Get_As_Json_Templated
141 ... ${BGP_VARIABLES_FOLDER}${/}empty_route
142 ... session=${CONFIG_SESSION}