aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/honeycomb/bgp.robot
blob: b39055196a4c8aab6ade0c59e6523216042ed655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# Copyright (c) 2017 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

*** Settings ***
| Library | resources.libraries.python.honeycomb.BGP.BGPKeywords
| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords

*** Keywords ***
| Configure BGP module
| | [Documentation] | Edit Honeycomb's configuration file for the BGP feature.\
| | ... | Honeycomb needs to be restarted for the changes to take effect.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - ip_address - IP address to bind BGP listener to. Type: string
| | ... | - port - Port number to bind BGP listener to. Type: integer
| | ... | - as_number - Autonomous System (AS) ID number. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Configure BGP module \| ${nodes['DUT1']} \| 192.168.0.1 \| ${179} \
| | ... | \| ${65000} \|
| | ...
| | [Arguments] | ${node} | ${ip_address} | ${port} | ${as_number}
| | Configure BGP base | ${node} | ${ip_address} | ${port} | ${as_number}

| No BGP peers should be configured
| | [Documentation] | Uses Honeycomb API to read BGP configuration and checks
| | ... | if there ary BGP peers conffigured.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| No BGP peers should be configured \| ${nodes['DUT1']} \|
| | ...
| | [Arguments] | ${node}
| | ...
| | ${oper_data}= | Get Full BGP Configuration | ${node}
| | Should be Empty | ${oper_data['bgp-openconfig-extensions:bgp']}

| Honeycomb adds BGP peer
| | [Documentation] | Uses Honeycomb API to add a BGP peer.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - address - IP address of the peer. Type: string
| | ... | - data - Peer configuration data. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds BGP peer \| ${nodes['DUT1']} \| 192.168.0.1 \
| | ... | \| ${data} \|
| | ...
| | [Arguments] | ${node} | ${address} | ${data}
| | ...
| | Add BGP Peer | ${node} | ${address} | ${data}

| BGP Peer From Honeycomb Should be
| | [Documentation] | Uses Honeycomb API to verify BGP peer config data.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - address - IP address of the peer. Type: string
| | ... | - data - Peer configuration data. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| BGP Peer From Honeycomb Should be \
| | ... | \| ${nodes['DUT1']} \| 192.168.0.1 \| ${data} \|
| | ...
| | [Arguments] | ${node} | ${address} | ${data}
| | ...
| | ${oper_data}= | Get BGP Peer | ${node} | ${address}
| | Compare Data Structures | ${oper_data} | ${data}

| Peer Operational Data From Honeycomb Should be
| | [Documentation] | Uses Honeycomb API to verify BGP peer operational data.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - address - IP address of the peer. Type: string
| | ... | - data - Peer configuration data. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| BGP Peer From Honeycomb Should be \
| | ... | \| ${nodes['DUT1']} \| 192.168.0.1 \| ${data} \|
| | ...
| | [Arguments] | ${node} | ${address}
| | ...
| | ${oper_data}= | Get BGP Peer | ${node} | ${address} | operational
| | Should be Equal | ${oper_data['peer'][0]['peer-id']} | bgp://${address}

| Honeycomb removes BGP peer
| | [Documentation] | Uses Honeycomb API to add a BGP peer.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - address - IP address of the peer. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds BGP peer \| ${nodes['DUT1']} \| 192.168.0.1 \|
| | ...
| | [Arguments] | ${node} | ${address}
| | ...
| | Remove BGP Peer | ${node} | ${address}

| Honeycomb configures BGP route
| | [Documentation] | Uses Honeycomb API to add a BGP route\
| | ... | to the specified peer.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - peer_address - IP address of the peer. Type: string
| | ... | - data - Peer configuration data. Type: dictionary
| | ... | - route_address - IP address of the route. Type: string
| | ... | - route_index - Numeric index of the route under the peer.\
| | ... | Type: integer
| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb adds BGP peer \| ${nodes['DUT1']} \| 192.168.0.1 \
| | ... | \| ${data} \| 192.168.0.2 \| ${0} \| ipv4 \|
| | ...
| | [Arguments] | ${node} | ${peer_address} | ${data}
| | ... | ${route_address} | ${route_index} | ${ip_version}
| | ...
| | Configure BGP Route | ${node} | ${peer_address} | ${data}
| | ... | ${route_address} | ${route_index} | ${ip_version}

| BGP Route From Honeycomb Should be
| | [Documentation] | Uses Honeycomb API to verify BGP route operational data.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - peer_address - IP address of the peer. Type: string
| | ... | - data - Peer configuration data. Type: dictionary
| | ... | - route_address - IP address of the route. Type: string
| | ... | - route_index - Numeric index of the route under the peer.\
| | ... | Type: integer
| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| BGP Peers From Honeycomb Should Include \
| | ... | \| ${nodes['DUT1']} \| ${data} \|
| | ...
| | [Arguments] | ${node} | ${peer_address} | ${data}
| | ... | ${route_address} | ${route_index} | ${ip_version}
| | ...
| | ${oper_data}= | Get BGP Route | ${node} | ${peer_address}
| | ... | ${route_address} | ${route_index} | ${ip_version}
| | Compare Data Structures | ${oper_data} | ${data}

| Honeycomb removes BGP route
| | [Documentation] | Uses Honeycomb API to remove a BGP route.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - peer_address - IP address of the peer. Type: string
| | ... | - route_address - IP address of the route. Type: string
| | ... | - route_index - Numeric index of the route under the peer.\
| | ... | Type: integer
| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb removes BGP route \| ${nodes['DUT1']} \| 192.168.0.1 \
| | ... | \| 192.168.0.2 \| ${0} \| ipv4 \|
| | ...
| | [Arguments] | ${node} | ${peer_address} | ${route_address}
| | ... | ${route_index} | ${ip_version}
| | ...
| | Remove BGP Route | ${node} | ${peer_address} | ${route_address}
| | ... | ${route_index} | ${ip_version}

| No BGP routes should be configured
| | [Documentation] | Uses Honeycomb API to verify that no BGP routes\
| | ... | are configured under the specified peer.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - peer_address - IP address of the peer. Type: string
| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| No BGP routes should be configured \| ${nodes['DUT1']} \
| | ... | \| 192.168.0.1 \| ipv4 \|
| | ...
| | [Arguments] | ${node} | ${peer_address} | ${ip_version}
| | ...
| | ${oper_data}= | Get All Peer Routes
| | ... | ${node} | ${peer_address} | ${ip_version}
| | Should be Empty | ${oper_data['bgp-inet:${ip_version}-routes']}

| No BGP routes should exist
| | [Documentation] | Uses Honeycomb API to verify that no BGP routes\
| | ... | exist under the specified peer.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - peer_address - IP address of the peer. Type: string
| | ... | - ip_version - IP protocol version, ipv4 or ipv6. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| No BGP routes should be configured \| ${nodes['DUT1']} \
| | ... | \| 192.168.0.1 \| ipv4 \|
| | ...
| | [Arguments] | ${node} | ${peer_address} | ${ip_version}
| | ...
| | Run keyword and expect error | *Status code: 404*
| | ... | Get All Peer Routes
| | ... | ${node} | ${peer_address} | ${ip_version}

| BGP Loc-RIB table should include
| | [Documentation] | Uses Honeycomb API to retrieve local BGP RIB table\
| | ... | And verifies that it contains the specified entry.
| | ...
| | ... | *Arguments:*
| | ... | - node - Information about a DUT node. Type: dictionary
| | ... | - data - RIB that should be present in operational data.\
| | ... | Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| BGP Loc-RIB table should include \| ${nodes['DUT1']} \| ${data} \|
| | ...
| | [Arguments] | ${node} | ${data}
| | ...
| | ${oper_data}= | Get BGP Local RIB | ${node}
| | ${oper_data}= | Set Variable | ${oper_data['loc-rib']['tables']}
| | ${data}= | Set Variable | ${data['loc-rib']['tables']}
| | Compare RIB Tables | ${oper_data} | ${data}

| Receive BGP OPEN message
| | [Documentation] | Open a TCP listener on BGP port(179) and listen\
| | ... | for BGP OPEN message. Verify ID and holdtime fields.
| | ...
| | ... | *Arguments:*
| | ... | - tg_node - Information about the TG node. Type: dictionary
| | ... | - rx_ip - IP address to listen on. Type: string
| | ... | - src_ip - IP address of the BGP speaker. Also acts as BGP peer ID.\
| | ... | Type: string
| | ... | - holdtime - Expected value of HOLD_TIME field in received message.\
| | ... | Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Receive BGP OPEN message \| ${node['TG']} \
| | ... | \| 192.168.0.1 \| 192.168.0.2 \| ${0}
| | ...
| | [Arguments] | ${tg_node} | ${rx_ip} | ${src_ip} | ${port} | ${as_number}
| | ... | ${holdtime}
| | ...
| | ${args}= | Catenate | --rx_ip | ${rx_ip}
| | ...                 | --src_ip | ${src_ip}
| | ...                 | --rx_port | ${port}
| | ...                 | --as_number | ${as_number}
| | ...                 | --holdtime | ${holdtime}
| | Run Traffic Script On Node | honeycomb/bgp_open.py
| | ... | ${tg_node} | ${args}