4 Vhosts setup test
[csit.git] / resources / libraries / robot / ipv6.robot
1 # Copyright (c) 2016 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 """IPv6 keywords"""
15
16 *** Settings ***
17 | Library | resources.libraries.python.IPv6Util
18 | Library | resources.libraries.python.IPv6Setup
19 | Library | resources.libraries.python.TrafficScriptExecutor
20 | Library | resources.libraries.python.NodePath
21 | Library | resources.libraries.python.Routing
22 | Library | resources.libraries.python.InterfaceUtil
23 | Library | resources.libraries.python.topology.Topology
24 | Resource | resources/libraries/robot/default.robot
25 | Resource | resources/libraries/robot/counters.robot
26 | Documentation | IPv6 keywords
27
28 *** Keywords ***
29 | Ipv6 icmp echo
30 | | [Documentation] | Type of the src_node must be TG and dst_node must be DUT
31 | | [Arguments] | ${tg_node} | ${dut_node} | ${nodes_addr}
32 | | Append Nodes | ${tg_node} | ${dut_node}
33 | | Compute Path
34 | | ${src_port} | ${src_node}= | First Interface
35 | | ${dst_port} | ${dst_node}= | Last Interface
36 | | ${src_ip}= | Get Node Port Ipv6 Address | ${src_node} | ${src_port} | ${nodes_addr}
37 | | ${dst_ip}= | Get Node Port Ipv6 Address | ${dst_node} | ${dst_port} | ${nodes_addr}
38 | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port}
39 | | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_port}
40 | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac}
41 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
42 | | Run Traffic Script On Node | icmpv6_echo.py | ${tg_node} | ${args}
43 | | Vpp dump stats | ${dst_node}
44 | | ${ipv6_counter}= | Vpp get interface ipv6 counter | ${dst_node} | ${dst_port}
45 | | Should Be Equal | ${ipv6_counter} | ${2} | #ICMPv6 neighbor advertisement + ICMPv6 echo request
46
47 | Ipv6 icmp echo sweep
48 | | [Documentation] | Type of the src_node must be TG and dst_node must be DUT
49 | | [Arguments] | ${src_node} | ${dst_node} | ${start_size} | ${end_size}
50 | | ...         | ${step} | ${nodes_addr}
51 | | Append Nodes | ${src_node} | ${dst_node}
52 | | Compute Path
53 | | ${src_port} | ${src_node}= | First Interface
54 | | ${dst_port} | ${dst_node}= | Last Interface
55 | | ${src_ip}= | Get Node Port Ipv6 Address | ${src_node} | ${src_port} | ${nodes_addr}
56 | | ${dst_ip}= | Get Node Port Ipv6 Address | ${dst_node} | ${dst_port} | ${nodes_addr}
57 | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port}
58 | | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_port}
59 | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac}
60 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
61 | | ${args}= | Set Variable
62 | | ...      | ${args} --start_size ${start_size} --end_size ${end_size} --step ${step}
63 | | Run Traffic Script On Node | ipv6_sweep_ping.py | ${src_node} | ${args} | ${20}
64
65 | Ipv6 tg to dut1 egress
66 | | [Documentation] | Send traffic from TG to first DUT egress interface
67 | | [Arguments] | ${tg_node} | ${first_dut} | ${second_dut} | ${nodes_addr}
68 | | Append Nodes | ${tg_node} | ${first_dut} | ${second_dut}
69 | | Compute Path
70 | | ${src_port} | ${src_node}= | First Interface
71 | | ${dst_port} | ${dst_node}= | Last Egress Interface
72 | | ${hop_port} | ${hop_node}= | First Ingress Interface
73 | | ${src_ip}= | Get Node Port Ipv6 Address | ${src_node} | ${src_port} | ${nodes_addr}
74 | | ${dst_ip}= | Get Node Port Ipv6 Address | ${dst_node} | ${dst_port} | ${nodes_addr}
75 | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port}
76 | | ${dst_mac}= | Get Interface Mac | ${hop_node} | ${hop_port}
77 | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac}
78 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
79 | | Run Traffic Script On Node | icmpv6_echo.py | ${tg_node} | ${args}
80
81
82 | Ipv6 tg to dut2 via dut1
83 | | [Documentation] | Send traffic from TG to second DUT through first DUT
84 | | [Arguments] | ${tg_node} | ${first_dut} | ${second_dut} | ${nodes_addr}
85 | | Append Nodes | ${tg_node} | ${first_dut} | ${second_dut}
86 | | Compute Path
87 | | ${src_port} | ${src_node}= | First Interface
88 | | ${dst_port} | ${dst_node}= | Last Interface
89 | | ${hop_port} | ${hop_node}= | First Ingress Interface
90 | | ${src_ip}= | Get Node Port Ipv6 Address | ${src_node} | ${src_port} | ${nodes_addr}
91 | | ${dst_ip}= | Get Node Port Ipv6 Address | ${dst_node} | ${dst_port} | ${nodes_addr}
92 | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port}
93 | | ${dst_mac}= | Get Interface Mac | ${hop_node} | ${hop_port}
94 | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac}
95 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
96 | | Run Traffic Script On Node | icmpv6_echo.py | ${tg_node} | ${args}
97
98 | Ipv6 tg to dut2 egress via dut1
99 | | [Documentation] | Send traffic from TG to second DUT egress interface through first DUT
100 | | [Arguments] | ${tg_node} | ${first_dut} | ${second_dut} | ${nodes_addr}
101 | | Append Nodes | ${tg_node} | ${first_dut} | ${second_dut} | ${tg_node}
102 | | Compute Path
103 | | ${src_port} | ${src_node}= | First Interface
104 | | ${dst_port} | ${dst_node}= | Last Egress Interface
105 | | ${hop_port} | ${hop_node}= | First Ingress Interface
106 | | ${src_ip}= | Get Node Port Ipv6 Address | ${src_node} | ${src_port} | ${nodes_addr}
107 | | ${dst_ip}= | Get Node Port Ipv6 Address | ${dst_node} | ${dst_port} | ${nodes_addr}
108 | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port}
109 | | ${dst_mac}= | Get Interface Mac | ${hop_node} | ${hop_port}
110 | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac}
111 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
112 | | Run Traffic Script On Node | icmpv6_echo.py | ${tg_node} | ${args}
113
114 | Ipv6 tg to tg routed
115 | | [Documentation] | Send traffic from one TG port to another through DUT nodes
116 | | ...             | and send reply back, also verify hop limit processing
117 | | [Arguments] | ${tg_node} | ${first_dut} | ${second_dut} | ${nodes_addr}
118 | | Append Nodes | ${tg_node} | ${first_dut} | ${second_dut} | ${tg_node}
119 | | Compute Path
120 | | ${src_port} | ${src_node}= | First Interface
121 | | ${dst_port} | ${dst_node}= | Last Interface
122 | | ${src_nh_port} | ${src_nh_node}= | First Ingress Interface
123 | | ${dst_nh_port} | ${dst_nh_node}= | Last Egress Interface
124 | | ${src_ip}= | Get Node Port Ipv6 Address | ${src_node} | ${src_port} | ${nodes_addr}
125 | | ${dst_ip}= | Get Node Port Ipv6 Address | ${dst_node} | ${dst_port} | ${nodes_addr}
126 | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port}
127 | | ${dst_mac}= | Get Interface Mac | ${src_node} | ${dst_port}
128 | | ${src_nh_mac}= | Get Interface Mac | ${src_nh_node} | ${src_nh_port}
129 | | ${dst_nh_mac}= | Get Interface Mac | ${dst_nh_node} | ${dst_nh_port}
130 | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${dst_port} | ${src_mac}
131 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
132 | | ${args}= | Catenate | ${args} | --src_nh_mac ${src_nh_mac}
133 | |          | ...      | --dst_nh_mac ${dst_nh_mac} | --h_num 2
134 | | Run Traffic Script On Node | icmpv6_echo_req_resp.py | ${tg_node} | ${args}
135
136 | Ipv6 neighbor solicitation
137 | | [Documentation] | Send IPv6 neighbor solicitation from TG to DUT
138 | | [Arguments] | ${tg_node} | ${dut_node} | ${nodes_addr}
139 | | Append Nodes | ${tg_node} | ${dut_node}
140 | | Compute Path
141 | | ${src_port} | ${src_node}= | First Interface
142 | | ${dst_port} | ${dst_node}= | Last Interface
143 | | ${src_ip}= | Get Node Port Ipv6 Address | ${src_node} | ${src_port} | ${nodes_addr}
144 | | ${dst_ip}= | Get Node Port Ipv6 Address | ${dst_node} | ${dst_port} | ${nodes_addr}
145 | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port}
146 | | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_port}
147 | | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac}
148 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
149 | | Run Traffic Script On Node | ipv6_ns.py | ${src_node} | ${args}
150
151 | Setup ipv6 to all dut in topology
152 | | [Documentation] | Setup IPv6 address on all DUTs
153 | | [Arguments] | ${nodes} | ${nodes_addr}
154 | | Setup all DUTs before test
155 | | ${interfaces}= | Nodes Set Ipv6 Addresses | ${nodes} | ${nodes_addr}
156 | | :FOR | ${interface} | IN | @{interfaces}
157 | | | Set Interface State | @{interface} | up
158 | | All Vpp Interfaces Ready Wait | ${nodes}
159
160 | Clear ipv6 on all dut in topology
161 | | [Documentation] | Remove IPv6 address on all DUTs
162 | | [Arguments] | ${nodes} | ${nodes_addr}
163 | | Nodes Clear Ipv6 Addresses | ${nodes} | ${nodes_addr}
164
165 | Vpp nodes ra suppress link layer
166 | | [Documentation] | Suppress ICMPv6 router advertisement message for link scope address
167 | | [Arguments] | ${nodes}
168 | | Vpp All Ra Suppress Link Layer | ${nodes}
169
170 | Vpp nodes setup ipv6 routing
171 | | [Documentation] | Setup routing on all VPP nodes required for IPv6 tests
172 | | [Arguments] | ${nodes} | ${nodes_addr}
173 | | Append Nodes | ${nodes['DUT1']} | ${nodes['DUT2']}
174 | | Compute Path
175 | | ${tg}= | Set Variable | ${nodes['TG']}
176 | | ${dut1_if} | ${dut1}= | First Interface
177 | | ${dut2_if} | ${dut2}= | Last Interface
178 | | ${dut1_if_addr}= | Get Node Port Ipv6 Address | ${dut1} | ${dut1_if} | ${nodes_addr}
179 | | ${dut2_if_addr}= | Get Node Port Ipv6 Address | ${dut2} | ${dut2_if} | ${nodes_addr}
180 | | @{tg_dut1_links}= | Get active links connecting "${tg}" and "${dut1}"
181 | | @{tg_dut2_links}= | Get active links connecting "${tg}" and "${dut2}"
182 | | :FOR | ${link} | IN | @{tg_dut1_links}
183 | | | ${net}= | Get Link Address | ${link} | ${nodes_addr}
184 | | | ${prefix}= | Get Link Prefix | ${link} | ${nodes_addr}
185 | | | Vpp Route Add | ${dut2} | ${net} | ${prefix} | ${dut1_if_addr} | ${dut2_if}
186 | | :FOR | ${link} | IN | @{tg_dut2_links}
187 | | | ${net}= | Get Link Address | ${link} | ${nodes_addr}
188 | | | ${prefix}= | Get Link Prefix | ${link} | ${nodes_addr}
189 | | | Vpp Route Add | ${dut1} | ${net} | ${prefix} | ${dut2_if_addr} | ${dut1_if}