CSIT-1009: SRv6 proxy tests
[csit.git] / resources / libraries / robot / overlay / srv6.robot
1 # Copyright (c) 2018 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | resources.libraries.python.SRv6
16 | Documentation | Keywords for SRv6 feature in VPP.
17
18 *** Keywords ***
19 | Configure SR LocalSID on DUT
20 | | [Documentation] | Create SRv6 LocalSID and binds it to a particular\
21 | | ... | behavior on the given DUT node.
22 | | ...
23 | | ... | *Arguments:*
24 | | ... | - dut_node - DUT node where to create localSID on. Type: dictionary
25 | | ... | - local_sid - LocalSID IPv6 address. Type: string
26 | | ... | - behavior - SRv6 LocalSID function. Type: string
27 | | ... | - interface - Interface name (Optional, default value: None; required
28 | | ... | for L2/L3 xconnects). Type: string
29 | | ... | - next_hop - Next hop IPv4/IPv6 address (Optional, default value:
30 | | ... | None; required for L3 xconnects). Type: string
31 | | ... | - fib_table - FIB table for IPv4/IPv6 lookup (Optional, default value:
32 | | ... | None; required for L3 routing). Type: string
33 | | ... | - out_if - Interface name of local interface for sending traffic
34 | | ... | towards the Service Function (Optional, default value: None;
35 | | ... | required for SRv6 endpoint to SR-unaware appliance). Type: string
36 | | ... | - in_if - Interface name of local interface receiving the traffic
37 | | ... | coming back from the Service Function (Optional, default value:
38 | | ... | None; required for SRv6 endpoint to SR-unaware appliance).
39 | | ... | Type: string
40 | | ... | - src_addr - Source address on the packets coming back on in_if
41 | | ... | interface (Optional, default value: None; required for SRv6 endpoint
42 | | ... | to SR-unaware appliance via static proxy). Type: string
43 | | ... | - sid_list - SID list (Optional, default value: []; required for SRv6
44 | | ... | endpoint to SR-unaware appliance via static proxy). Type: list
45 | | ...
46 | | ... | *Example:*
47 | | ...
48 | | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT1']} \| B:: \| end \|
49 | | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT1']} \| C:: \
50 | | ... | \| end.dx2 \| interface=GigabitEthernet0/10/0 \|
51 | | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT1']} \| D:: \
52 | | ... | \| end.dx4 \| interface=GigabitEthernet0/8/0 \| next_hop=10.0.0.1 \|
53 | | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT2']} \| E:: \
54 | | ... | \| end.dt6 \| fib_table=2 \|
55 | | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT2']} \| E:: \
56 | | ... | \| end.ad \| next_hop=10.0.0.1 \| out_if=DUT2_VHOST1 \
57 | | ... | \| in_if=DUT2_VHOST2 \|
58 | | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT2']} \| E:: \
59 | | ... | \| end.as \| next_hop=10.0.0.1 \| out_if=DUT2_VHOST1 \
60 | | ... | \| in_if=DUT2_VHOST2 \| src_addr=B:: \| sid_list=['C::', 'D::'] \|
61 | | ...
62 | | [Arguments] | ${dut_node} | ${local_sid} | ${behavior}
63 | | ... | ${interface}=${None} | ${next_hop}=${None} | ${fib_table}=${None}
64 | | ... | ${out_if}=${None} | ${in_if}=${None} | ${src_addr}=${None}
65 | | ... | @{sid_list}
66 | | ...
67 | | Configure SR LocalSID | ${dut_node} | ${local_sid} | ${behavior}
68 | | ... | interface=${interface} | next_hop=${next_hop} | fib_table=${fib_table}
69 | | ... | out_if=${out_if} | in_if=${in_if} | src_addr=${src_addr}
70 | | ... | sid_list=${sid_list}
71
72 | Delete SR LocalSID on DUT
73 | | [Documentation] | Delete SRv6 LocalSID on the given DUT node.
74 | | ...
75 | | ... | *Arguments:*
76 | | ... | - dut_node - DUT node where to delete localSID on. Type: dictionary
77 | | ... | - local_sid - LocalSID IPv6 address. Type: string
78 | | ...
79 | | ... | *Example:*
80 | | ...
81 | | ... | \| Delete SR LocalSID on DUT \| ${nodes['DUT1']} \| B:: \|
82 | | ...
83 | | [Arguments] | ${dut_node} | ${local_sid}
84 | | ...
85 | | Delete SR LocalSID | ${dut_node} | ${local_sid}
86
87 | Show SR LocalSIDs on DUT
88 | | [Documentation] | Show SRv6 LocalSIDs on the given DUT node.
89 | | ...
90 | | ... | *Arguments:*
91 | | ... | - dut_node - DUT node where to show SR localSIDs on. Type: dictionary
92 | | ...
93 | | ... | *Example:*
94 | | ...
95 | | ... | \| Show SR LocalSIDs on DUT \| ${nodes['DUT1']} \|
96 | | ...
97 | | [Arguments] | ${dut_node}
98 | | ...
99 | | Show SR LocalSIDs | ${dut_node}
100
101 | Configure SR Policy on DUT
102 | | [Documentation] | Create SRv6 policy on the given DUT node.
103 | | ...
104 | | ... | *Arguments:*
105 | | ... | - dut_node - DUT node where to create SRv6 policy on. Type: dictionary
106 | | ... | - bsid - BindingSID - local SID IPv6 address. Type: string
107 | | ... | - mode - Encapsulation / insertion mode. Type: string
108 | | ... | - sid_list - SID list. Type: list
109 | | ...
110 | | ... | *Example:*
111 | | ...
112 | | ... | \| Configure SR Policy on DUT \| ${nodes['DUT2']} \| A:: \| encap \
113 | | ... | \| B::\| C:: \|
114 | | ... | \| Configure SR Policy on DUT \| ${nodes['DUT2']} \| D:: \| insert \
115 | | ... | \| E::\| F:: \|
116 | | ...
117 | | [Arguments] | ${dut_node} | ${bsid} | ${mode} | @{sid_list}
118 | | ...
119 | | Configure SR Policy | ${dut_node} | ${bsid} | ${sid_list} | mode=${mode}
120
121 | Delete SR Policy on DUT
122 | | [Documentation] | Delete SRv6 policy on the given DUT node.
123 | | ...
124 | | ... | *Arguments:*
125 | | ... | - dut_node - DUT node where to delete SRv6 policy on. Type: dictionary
126 | | ... | - bsid - BindingSID - local SID IPv6 address. Type: string
127 | | ...
128 | | ... | *Example:*
129 | | ...
130 | | ... | \| Delete SR Policy on DUT \| ${nodes['DUT1']} \| A:: \|
131 | | ...
132 | | [Arguments] | ${dut_node} | ${bsid}
133 | | ...
134 | | Delete SR Policy | ${dut_node} | ${bsid}
135
136 | Show SR Policies on DUT
137 | | [Documentation] | Show SRv6 policies on the given DUT node.
138 | | ...
139 | | ... | *Arguments:*
140 | | ... | - dut_node - DUT node where to show SR policies on. Type: dictionary
141 | | ...
142 | | ... | *Example:*
143 | | ...
144 | | ... | \| Show SR Policies on DUT \| ${nodes['DUT1']} \|
145 | | ...
146 | | [Arguments] | ${dut_node}
147 | | ...
148 | | Show SR Policies | ${dut_node}
149
150 | Configure SR Steer on DUT
151 | | [Documentation] | Create SRv6 steering policy on the given DUT node.
152 | | ...
153 | | ... | *Arguments:*
154 | | ... | - dut_node - DUT node where to create SR steering policy on.
155 | | ... | Type: dictionary
156 | | ... | - mode - Mode of operation - L2 or L3. Type: string
157 | | ... | - bsid - BindingSID - local SID IPv6 address. Type: string
158 | | ... | - interface - Interface name (Optional, default value: None; required
159 | | ... | in case of L2 mode). Type: string
160 | | ... | - ip_addr - IPv4/IPv6 address (Optional, default value: None; required
161 | | ... | in case of L3 mode). Type: string
162 | | ... | - prefix - IP address prefix (Optional, default value: None; required
163 | | ... | for L3 mode). Type: integer
164 | | ...
165 | | ... | *Example:*
166 | | ...
167 | | ... | \| Configure SR Steer on DUT \| ${nodes['DUT1']} \| L2 \| B:: \
168 | | ... | \| interface=GigabitEthernet0/10/0 \|
169 | | ... | \| Configure SR Steer on DUT \| ${nodes['DUT1']} \| L3 \| C:: \
170 | | ... | \| ip_address=2001::1 \| prefix=64 \|
171 | | ...
172 | | [Arguments] | ${dut_node} | ${mode} | ${bsid}
173 | | ... | ${interface}=${None} | ${ip_addr}=${None} | ${prefix}=${None}
174 | | ...
175 | | Configure SR Steer | ${dut_node} | ${mode} | ${bsid}
176 | | ... | interface=${interface} | ip_addr=${ip_addr} | prefix=${prefix}
177
178 | Delete SR Steer on DUT
179 | | [Documentation] | Delete SRv6 steering policy on the given DUT node.
180 | | ...
181 | | ... | *Arguments:*
182 | | ... | - dut_node - DUT node where to delete SR steering policy on.
183 | | ... | Type: dictionary
184 | | ... | - mode - Mode of operation - L2 or L3. Type: string
185 | | ... | - bsid - BindingSID - local SID IPv6 address. Type: string
186 | | ... | - interface - Interface name (Optional, default value: None; required
187 | | ... | in case of L2 mode). Type: string
188 | | ... | - ip_addr - IPv4/IPv6 address (Optional, default value: None; required
189 | | ... | in case of L3 mode). Type: string
190 | | ... | - prefix - IP address prefix (Optional, default value: None; required
191 | | ... | for L3 mode). Type: integer
192 | | ...
193 | | ... | *Example:*
194 | | ...
195 | | ... | \| Delete SR Steer on DUT \| ${nodes['DUT1']} \| L2 \| B:: \
196 | | ... | \| interface=GigabitEthernet0/10/0 \|
197 | | ... | \| Delete SR Steer on DUT \| ${nodes['DUT1']} \| L3 \| C:: \
198 | | ... | \| ip_address=2001::1 \| prefix=64 \|
199 | | ...
200 | | [Arguments] | ${dut_node} | ${mode} | ${bsid}
201 | | ... | ${interface}=${None} | ${ip_addr}=${None} | ${prefix}=${None}
202 | | ...
203 | | Delete SR Steer | ${dut_node} | ${mode} | ${bsid}
204 | | ... | interface=${interface} | ip_addr=${ip_addr} | prefix=${prefix}
205
206 | Show SR Steering Policies on DUT
207 | | [Documentation] | Show SRv6 steering policies on the given DUT node.
208 | | ...
209 | | ... | *Arguments:*
210 | | ... | - dut_node - DUT node where to show SR steering policies on.
211 | | ... | Type: dictionary
212 | | ...
213 | | ... | *Example:*
214 | | ...
215 | | ... | \| Show SR Steering Policies on DUT \| ${nodes['DUT1']} \|
216 | | ...
217 | | [Arguments] | ${dut_node}
218 | | ...
219 | | Show SR Steering Policies | ${dut_node}
220
221 | Set SR Encaps Source Address on DUT
222 | | [Documentation] | Set SRv6 encapsulation source address on the given DUT
223 | | ... | node.
224 | | ...
225 | | ... | *Arguments:*
226 | | ... | - dut_node - DUT node where to set SRv6 encapsulation source address
227 | | ... | on. Type: dictionary
228 | | ... | - ip6_addr - Local SID IPv6 address. Type: string
229 | | ...
230 | | ... | *Example:*
231 | | ...
232 | | ... | \| Set SR Encaps Source Address on DUT \| ${nodes['DUT1']} \| B:: \|
233 | | ...
234 | | [Arguments] | ${dut_node} | ${ip6_addr}
235 | | ...
236 | | Set SR Encaps Source Address | ${dut_node} | ip6_addr=${ip6_addr}
237
238 | Show SR Policies on all DUTs
239 | | [Documentation] | Show SRv6 policies on all DUT nodes in topology.
240 | | ...
241 | | ... | *Arguments:*
242 | | ... | - nodes - Topology. Type: dictionary
243 | | ...
244 | | ... | *Example:*
245 | | ...
246 | | ... | \| Show SR Policies on all DUTs \| ${nodes} \|
247 | | ...
248 | | [Arguments] | ${nodes}
249 | | ...
250 | | ${duts}= | Get Matches | ${nodes} | DUT*
251 | | :FOR | ${dut} | IN | @{duts}
252 | | | Show SR Policies | ${nodes['${dut}']}
253
254 | Show SR Steering Policies on all DUTs
255 | | [Documentation] | Show SRv6 steering policies on all DUT nodes in topology.
256 | | ...
257 | | ... | *Arguments:*
258 | | ... | - nodes - Topology. Type: dictionary
259 | | ...
260 | | ... | *Example:*
261 | | ...
262 | | ... | \| Show SR Steering Policies on all DUTs \| ${nodes} \|
263 | | ...
264 | | [Arguments] | ${nodes}
265 | | ...
266 | | ${duts}= | Get Matches | ${nodes} | DUT*
267 | | :FOR | ${dut} | IN | @{duts}
268 | | | Show SR Steering Policies | ${nodes['${dut}']}
269
270 | Show SR LocalSIDs on all DUTs
271 | | [Documentation] | Show SRv6 LocalSIDs on all DUT nodes in topology.
272 | | ...
273 | | ... | *Arguments:*
274 | | ... | - nodes - Topology. Type: dictionary
275 | | ...
276 | | ... | *Example:*
277 | | ...
278 | | ... | \| Show SR LocalSIDs on all DUTs \| ${nodes} \|
279 | | ...
280 | | [Arguments] | ${nodes}
281 | | ...
282 | | ${duts}= | Get Matches | ${nodes} | DUT*
283 | | :FOR | ${dut} | IN | @{duts}
284 | | | Show SR LocalSIDs | ${nodes['${dut}']}