ffbd506f1d1b4c7a1d7268d5ae38eb8997da7f16
[csit.git] / resources / libraries / robot / ip / geneve.robot
1 # Copyright (c) 2021 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.GeneveUtil
16 |
17 | Documentation | Keywords for GENEVE tunnels in VPP.
18
19 *** Keywords ***
20 | Initialize GENEVE L3 mode in circular topology
21 | | [Documentation] | Initialization of GENEVE L3 mode on DUT1.
22 | |
23 | | [Arguments] | ${with_bypass}=${False}
24 | |
25 | | Set interfaces in path up
26 | |
27 | | VPP Interface Set IP Address
28 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${dut1_if1_ip4} | 24
29 | | VPP Add IP Neighbor
30 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${tg_if1_ip4} | ${TG_pf1_mac}[0]
31 | | VPP Interface Set IP Address
32 | | ... | ${dut1} | ${DUT1_${int}2}[0] | ${dut1_if2_ip4} | 24
33 | | VPP Add IP Neighbor
34 | | ... | ${dut1} | ${DUT1_${int}2}[0] | ${tg_if2_ip4} | ${TG_pf2_mac}[0]
35 | | ${next_index}= | VPP Add Graph Node Next
36 | | ... | ${dut1} | geneve4-input | ethernet-input
37 | |
38 | | ${src_ip_int} = | IP To Int | ${gen_tunnel.src_ip}
39 | | ${dst_ip_int} = | IP To Int | ${gen_tunnel.dst_ip}
40 | | ${if_ip_int} = | IP To Int | ${gen_tunnel.if_ip}
41 | |
42 | | FOR | ${nr} | IN RANGE | 0 | ${n_tunnels}
43 | | | ${src_ip} = | Int To IP | ${${src_ip_int} + ${nr} * 256}
44 | | | ${dst_ip} = | Int To IP | ${${dst_ip_int} + ${nr} * 256}
45 | | | ${if_ip} = | Int To IP | ${${if_ip_int} + ${nr} * 256}
46 | | | Vpp Route Add
47 | | | ... | ${dut1} | ${src_ip} | ${gen_tunnel.ip_mask}
48 | | | ... | gateway=${tg_if1_ip4} | interface=${DUT1_${int}1}[0]
49 | | | ${tunnel_sw_index}= | Add Geneve Tunnel
50 | | | ... | ${dut1} | ${gen_tunnel.local} | ${gen_tunnel.remote}
51 | | | ... | ${${gen_tunnel.vni} + ${nr}} | l3_mode=${True}
52 | | | ... | next_index=${next_index}
53 | | | ${tunnel_if_key}= | Get Interface By SW Index
54 | | | ... | ${dut1} | ${tunnel_sw_index}
55 | | | ${tunnel_if_mac}= | Get Interface MAC
56 | | | ... | ${dut1} | ${tunnel_if_key}
57 | | | VPP Interface Set IP Address
58 | | | ... | ${dut1} | ${tunnel_if_key} | ${if_ip} | 24
59 | | | VPP Add IP Neighbor
60 | | | ... | ${dut1} | ${tunnel_if_key} | ${tg_if2_ip4} | ${TG_pf2_mac}[0]
61 | | | Vpp Route Add
62 | | | ... | ${dut1} | ${dst_ip} | ${gen_tunnel.ip_mask}
63 | | | ... | gateway=${tg_if2_ip4} | interface=${tunnel_if_key}
64 | | | Vpp Route Add
65 | | | ... | ${dut1} | ${gen_tunnel.remote} | 32
66 | | | ... | gateway=${tg_if2_ip4} | interface=${DUT1_${int}2}[0]
67 | | | VPP Add IP Neighbor
68 | | | ... | ${dut1} | ${tunnel_if_key} | ${gen_tunnel.local} | ${tunnel_if_mac}
69 | | | Vpp Route Add
70 | | | ... | ${dut1} | ${gen_tunnel.local} | 32 | gateway=${if_ip}
71 | | | Set Interface State
72 | | | ... | ${dut1} | ${tunnel_if_key} | up
73 | | END
74 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}