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