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