CSIT-1459: Migrate IP libraries from VAT to PAPI
[csit.git] / resources / libraries / robot / ip / ip6.robot
1 # Copyright (c) 2019 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.InterfaceUtil
16 | Library | resources.libraries.python.IPUtil
17 | Library | resources.libraries.python.IPv6Util
18 | Library | resources.libraries.python.NodePath
19 | Library | resources.libraries.python.topology.Topology
20 | Library | resources.libraries.python.TrafficScriptExecutor
21 | ...
22 | Resource | resources/libraries/robot/shared/counters.robot
23 | Resource | resources/libraries/robot/shared/default.robot
24 | Resource | resources/libraries/robot/shared/testing_path.robot
25 | ...
26 | Documentation | IPv6 keywords
27
28 *** Keywords ***
29 | Get interface Ipv6 addresses
30 | | [Documentation] | Get IPv6 address for the given interface of the node.
31 | | ...
32 | | ... | *Arguments:*
33 | | ... | - node - DUT node data. Type: dictionary
34 | | ... | - interface - Name of the interface on the VPP node. Type: string
35 | | ...
36 | | [Arguments] | ${node} | ${interface}
37 | | ...
38 | | [Return] | ${ip_data}
39 | | ...
40 | | ${ip_data}= | VPP get interface ip addresses
41 | | ... | ${node} | ${interface} | ipv6
42
43 | Suppress ICMPv6 router advertisement message
44 | | [Documentation] | Suppress ICMPv6 router advertisement message for link
45 | | ... | scope address
46 | | [Arguments] | ${nodes}
47 | | Vpp All Ra Suppress Link Layer | ${nodes}
48
49 | Configure IPv6 forwarding in circular topology
50 | | [Documentation]
51 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node / 3-node
52 | | ... | circular topology. Get the interface MAC addresses and setup ARP on
53 | | ... | all VPP interfaces. Setup IPv6 addresses with /64 prefix on DUT-TG
54 | | ... | links. In case of 3-node topology setup IPv6 adresses with /96 prefix
55 | | ... | on DUT1-DUT2 link and set routing on both DUT nodes with prefix /64
56 | | ... | and next hop of neighbour DUT interface IPv6 address. Configure route
57 | | ... | entries for remote hosts IPv6 addresses if required.
58 | | ...
59 | | ... | *Arguments:*
60 | | ... | - tg_if1_ip6 - IPv6 address of TG interface1. Type: string
61 | | ... | - tg_if2_ip6 - IPv6 address of TG interface2. Type: string
62 | | ... | - dut1_if1_ip6 - IPv6 address of DUT1 interface1. Type: string
63 | | ... | - dut1_if2_ip6 - IPv6 address of DUT1 interface1. Type: string
64 | | ... | - dut2_if1_ip6 - IPv6 address of DUT2 interface1 (Optional).
65 | | ... | Type: string
66 | | ... | - dut2_if2_ip6 - IPv6 address of DUT2 interface2 (Optional).
67 | | ... | Type: string
68 | | ... | - remote_host1_ip6 - IPv6 address of remote host1 (Optional).
69 | | ... | Type: string
70 | | ... | - remote_host2_ip6 - IPv6 address of remote host2 (Optional).
71 | | ... | Type: string
72 | | ... | - remote_host_ip6_prefix - IPv6 address prefix for host IPv6 addresses
73 | | ... | (Optional). Type: string or integer
74 | | ...
75 | | ... | *Example:*
76 | | ...
77 | | ... | \| Configure IPv6 forwarding in circular topology \
78 | | ... | \| 2001:1::2 \| 2001:2::2 \| 2001:1::1 \| 2001:2::1 \|
79 | | ... | \| Configure IPv6 forwarding in circular topology \
80 | | ... | \| 2001:1::2 \| 2001:2::2 \| 2001:1::1 \| 2001:2::1 \
81 | | ... | \| remote_host1_ip6=3ffe:5f::1 \| remote_host2_ip6=3ffe:5f::2 \
82 | | ... | \| remote_host_ip6_prefix=128 \|
83 | | ... | \| Configure IPv6 forwarding in circular topology \
84 | | ... | \| 2001:1::2 \| 2001:2::2 \| 2001:1::1 \| 2003:3::1 \| 2003:3::2 \
85 | | ... | \| 2001:2::1 \|
86 | | ... | \| Configure IPv6 forwarding in circular topology \
87 | | ... | \| 2001:1::2 \| 2001:2::2 \| 2001:1::1 \| 2003:3::1 \| 2003:3::2 \
88 | | ... | \| 2001:2::1 \| remote_host1_ip4=3ffe:5f::1 \
89 | | ... | \| remote_host2_ip4=3ffe:5f::2 \| remote_host_ip4_prefix=128 \|
90 | | ...
91 | | [Arguments] | ${tg_if1_ip6} | ${tg_if2_ip6} | ${dut1_if1_ip6}
92 | | ... | ${dut1_if2_ip6} | ${dut2_if1_ip6}=${NONE} | ${dut2_if2_ip6}=${NONE}
93 | | ... | ${remote_host1_ip6}=${NONE} | ${remote_host2_ip6}=${NONE}
94 | | ... | ${remote_host_ip6_prefix}=${NONE}
95 | | ...
96 | | ...
97 | | Configure interfaces in path up
98 | | ...
99 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
100 | | ... | Variable Should Exist | ${dut2_node}
101 | | ...
102 | | Run Keyword If | '${dut2_status}' == 'PASS'
103 | | ... | Configure IPv6 forwarding in 3-node circular topology
104 | | ... | ${tg_if1_ip6} | ${tg_if2_ip6} | ${dut1_if1_ip6} | ${dut1_if2_ip6}
105 | | ... | ${dut2_if1_ip6} | ${dut2_if2_ip6} | ${remote_host1_ip6}
106 | | ... | ${remote_host2_ip6} | ${remote_host_ip6_prefix}
107 | | ... | ELSE
108 | | ... | Configure IPv6 forwarding in 2-node circular topology
109 | | ... | ${tg_if1_ip6} | ${tg_if2_ip6} | ${dut1_if1_ip6} | ${dut1_if2_ip6}
110 | | ... | remote_host1_ip6=${remote_host1_ip6}
111 | | ... | remote_host2_ip6=${remote_host2_ip6}
112 | | ... | remote_host_ip6_prefix=${remote_host_ip6_prefix}
113
114 | Configure IPv6 forwarding in 2-node circular topology
115 | | [Documentation]
116 | | ... | Set UP state on VPP interfaces on DUT node in 2-node circular
117 | | ... | topology. Get the interface MAC addresses and setup ARP on
118 | | ... | all VPP interfaces. Setup IPv6 addresses with /64 prefix on DUT-TG
119 | | ... | links. Configure route entries for remote hosts IPv6 addresses
120 | | ... | if required.
121 | | ...
122 | | ... | *Arguments:*
123 | | ... | - tg_if1_ip6 - IPv6 address of TG interface1. Type: string
124 | | ... | - tg_if2_ip6 - IPv6 address of TG interface2. Type: string
125 | | ... | - dut1_if1_ip6 - IPv6 address of DUT1 interface1. Type: string
126 | | ... | - dut1_if2_ip6 - IPv6 address of DUT1 interface1. Type: string
127 | | ... | - remote_host1_ip6 - IPv6 address of remote host1 (Optional).
128 | | ... | Type: string
129 | | ... | - remote_host2_ip6 - IPv6 address of remote host2 (Optional).
130 | | ... | Type: string
131 | | ... | - remote_host_ip6_prefix - IPv6 address prefix for host IPv6 addresses
132 | | ... | (Optional). Type: string or integer
133 | | ...
134 | | ... | *Example:*
135 | | ...
136 | | ... | \| Configure IPv6 forwarding in circular topology \
137 | | ... | \| 2001:1::2 \| 2001:2::2 \| 2001:1::1 \| 2001:2::1 \|
138 | | ... | \| Configure IPv6 forwarding in circular topology \
139 | | ... | \| 2001:1::2 \| 2001:2::2 \| 2001:1::1 \| 2001:2::1 \
140 | | ... | \| remote_host1_ip6=3ffe:5f::1 \| remote_host2_ip6=3ffe:5f::2 \
141 | | ... | \| remote_host_ip6_prefix=128 \|
142 | | ...
143 | | [Arguments] | ${tg_if1_ip6} | ${tg_if2_ip6} | ${dut1_if1_ip6}
144 | | ... | ${dut1_if2_ip6} | ${remote_host1_ip6}=${NONE}
145 | | ... | ${remote_host2_ip6}=${NONE} | ${remote_host_ip6_prefix}=${NONE}
146 | | ...
147 | | ${dut_tg_ip6_prefix}= | Set Variable | 64
148 | | ...
149 | | VPP Add IP Neighbor
150 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${tg_if1_ip6} | ${tg_to_dut_if1_mac}
151 | | VPP Add IP Neighbor
152 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${tg_if2_ip6} | ${tg_to_dut_if2_mac}
153 | | ...
154 | | VPP Interface Set IP Address | ${dut_node}
155 | | ... | ${dut_to_tg_if1} | ${dut1_if1_ip6} | ${dut_tg_ip6_prefix}
156 | | VPP Interface Set IP Address | ${dut_node}
157 | | ... | ${dut_to_tg_if2} | ${dut1_if2_ip6} | ${dut_tg_ip6_prefix}
158 | | ...
159 | | Run Keyword Unless | '${remote_host1_ip6}' == '${NONE}'
160 | | ... | Vpp Route Add | ${dut_node} | ${remote_host1_ip6}
161 | | ... | ${remote_host_ip6_prefix} | gateway=${tg_if1_ip6}
162 | | ... | interface=${dut_to_tg_if1}
163 | | Run Keyword Unless | '${remote_host2_ip6}' == '${NONE}'
164 | | ... | Vpp Route Add | ${dut_node} | ${remote_host2_ip6}
165 | | ... | ${remote_host_ip6_prefix} | gateway=${tg_if2_ip6}
166 | | ... | interface=${dut_to_tg_if2}
167
168 | Configure IPv6 forwarding in 3-node circular topology
169 | | [Documentation]
170 | | ... | Set UP state on VPP interfaces in path on nodes in 3-node circular
171 | | ... | topology. Get the interface MAC addresses and setup ARP on all VPP
172 | | ... | interfaces. Setup IPv6 addresses with /64 prefix on DUT-TG links.
173 | | ... | Configure IPv6 adresses with /96 prefix on DUT1-DUT2 link and set
174 | | ... | routing on both DUT nodes with prefix /64 and next hop of neighbour
175 | | ... | DUT interface IPv6 address. Configure route entries for remote hosts
176 | | ... | IPv6 addresses if required.
177 | | ...
178 | | ... | *Arguments:*
179 | | ... | - tg_if1_ip6 - IPv6 address of TG interface1. Type: string
180 | | ... | - tg_if2_ip6 - IPv6 address of TG interface2. Type: string
181 | | ... | - dut1_if1_ip6 - IPv6 address of DUT1 interface1. Type: string
182 | | ... | - dut1_if2_ip6 - IPv6 address of DUT1 interface1. Type: string
183 | | ... | - dut2_if1_ip6 - IPv6 address of DUT2 interface1 Type: string
184 | | ... | - dut2_if2_ip6 - IPv6 address of DUT2 interface2 Type: string
185 | | ... | - remote_host1_ip6 - IPv6 address of remote host1 (Optional).
186 | | ... | Type: string
187 | | ... | - remote_host2_ip6 - IPv6 address of remote host2 (Optional).
188 | | ... | Type: string
189 | | ... | - remote_host_ip6_prefix - IPv6 address prefix for host IPv6 addresses
190 | | ... | (Optional). Type: string or integer
191 | | ...
192 | | ... | *Example:*
193 | | ...
194 | | ... | \| Configure IPv6 forwarding in circular topology \
195 | | ... | \| 2001:1::2 \| 2001:2::2 \| 2001:1::1 \| 2003:3::1 \| 2003:3::2 \
196 | | ... | \| 2001:2::1 \|
197 | | ... | \| Configure IPv6 forwarding in circular topology \
198 | | ... | \| 2001:1::2 \| 2001:2::2 \| 2001:1::1 \| 2003:3::1 \| 2003:3::2 \
199 | | ... | \| 2001:2::1 \| remote_host1_ip4=3ffe:5f::1 \
200 | | ... | \| remote_host2_ip4=3ffe:5f::2 \| remote_host_ip4_prefix=128 \|
201 | | ...
202 | | [Arguments] | ${tg_if1_ip6} | ${tg_if2_ip6} | ${dut1_if1_ip6}
203 | | ... | ${dut1_if2_ip6} | ${dut2_if1_ip6} | ${dut2_if2_ip6}
204 | | ... | ${remote_host1_ip6}=${NONE} | ${remote_host2_ip6}=${NONE}
205 | | ... | ${remote_host_ip6_prefix}=${NONE}
206 | | ...
207 | | ${dut_tg_ip6_prefix}= | Set Variable | 64
208 | | ${dut_link_ip6_prefix}= | Set Variable | 96
209 | | ...
210 | | VPP Add IP Neighbor
211 | | ... | ${dut1_node} | ${dut1_to_tg} | ${tg_if1_ip6} | ${tg_to_dut1_mac}
212 | | VPP Add IP Neighbor
213 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut2_if1_ip6} | ${dut2_to_dut1_mac}
214 | | VPP Add IP Neighbor
215 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut1_if2_ip6} | ${dut1_to_dut2_mac}
216 | | VPP Add IP Neighbor
217 | | ... | ${dut2_node} | ${dut2_to_tg} | ${tg_if2_ip6} | ${tg_to_dut2_mac}
218 | | ...
219 | | VPP Interface Set IP Address
220 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_if1_ip6} | ${dut_tg_ip6_prefix}
221 | | VPP Interface Set IP Address | ${dut1_node}
222 | | ... | ${dut1_to_dut2} | ${dut1_if2_ip6} | ${dut_link_ip6_prefix}
223 | | VPP Interface Set IP Address | ${dut2_node}
224 | | ... | ${dut2_to_dut1} | ${dut2_if1_ip6} | ${dut_link_ip6_prefix}
225 | | VPP Interface Set IP Address
226 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_if2_ip6} | ${dut_tg_ip6_prefix}
227 | | ...
228 | | Vpp Route Add | ${dut1_node} | ${tg_if2_ip6} | ${dut_tg_ip6_prefix}
229 | | ... | gateway=${dut2_if1_ip6} | interface=${dut1_to_dut2}
230 | | Vpp Route Add | ${dut2_node} | ${tg_if1_ip6} | ${dut_tg_ip6_prefix}
231 | | ... | gateway=${dut1_if2_ip6} | interface=${dut2_to_dut1}
232 | | ...
233 | | Run Keyword Unless | '${remote_host1_ip6}' == '${NONE}'
234 | | ... | Vpp Route Add | ${dut1_node} | ${remote_host1_ip6}
235 | | ... | ${remote_host_ip6_prefix} | gateway=${tg_if1_ip6}
236 | | ... | interface=${dut1_to_tg}
237 | | Run Keyword Unless | '${remote_host2_ip6}' == '${NONE}'
238 | | ... | Vpp Route Add | ${dut1_node} | ${remote_host2_ip6}
239 | | ... | ${remote_host_ip6_prefix} | gateway=${dut2_if1_ip6}
240 | | ... | interface=${dut1_to_dut2}
241 | | Run Keyword Unless | '${remote_host1_ip6}' == '${NONE}'
242 | | ... | Vpp Route Add | ${dut2_node} | ${remote_host1_ip6}
243 | | ... | ${remote_host_ip6_prefix} | gateway=${dut1_if2_ip6}
244 | | ... | interface=${dut2_to_dut1}
245 | | Run Keyword Unless | '${remote_host2_ip6}' == '${NONE}'
246 | | ... | Vpp Route Add | ${dut2_node} | ${remote_host2_ip6}
247 | | ... | ${remote_host_ip6_prefix} | gateway=${tg_if2_ip6}
248 | | ... | interface=${dut2_to_tg}