e855f2499dd0ab5118db42a5da403782fdf80bcf
[csit.git] / resources / libraries / robot / vxlan.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 *** Settings ***
15 | Library  | Collections
16 | Resource | resources/libraries/robot/default.robot
17 | Resource | resources/libraries/robot/bridge_domain.robot
18 | Resource | resources/libraries/robot/l2_xconnect.robot
19 | Library  | resources.libraries.python.L2Util
20 | Library  | resources.libraries.python.IPUtil
21 | Library  | resources.libraries.python.IPv4Util
22 | Library  | resources.libraries.python.IPv4Setup
23 | Library  | resources.libraries.python.InterfaceSetup
24 | Library  | resources.libraries.python.InterfaceUtil
25 | Library  | resources.libraries.python.topology.Topology
26 | Library  | resources.libraries.python.NodePath
27
28
29 *** Keywords ***
30 | Setup VXLAN tunnel on nodes
31 | | [Arguments] | ${TG} | ${DUT1} | ${DUT2} | ${VNI}
32 | | Append Nodes | ${TG} | ${DUT1} | ${DUT2} | ${TG}
33 | | Compute Path
34 | | ${tgs_to_dut1} | ${tg}= | Next Interface
35 | | ${dut1s_to_tg} | ${dut1}= | Next Interface
36 | | ${dut1s_to_dut2} | ${dut1}= | Next Interface
37 | | ${dut2s_to_dut1} | ${dut2}= | Next Interface
38 | | ${dut2s_to_tg} | ${dut2}= | Next Interface
39 | | ${tgs_to_dut2} | ${tg}= | Next Interface
40 | | Set Suite Variable | ${tgs_to_dut1}
41 | | Set Suite Variable | ${dut1s_to_tg}
42 | | Set Suite Variable | ${tgs_to_dut2}
43 | | Set Suite Variable | ${dut2s_to_tg}
44 | | Set Suite Variable | ${dut1s_to_dut2}
45 | | Set Suite Variable | ${dut2s_to_dut1}
46 # TODO: replace with address generator
47 | | Set Suite Variable | ${dut1s_ip_address} | 172.16.0.1
48 | | Set Suite Variable | ${dut2s_ip_address} | 172.16.0.2
49 | | Set Suite Variable | ${duts_ip_address_prefix} | 24
50 | | Set Interface State | ${TG} | ${tgs_to_dut1} | up
51 | | Set Interface State | ${TG} | ${tgs_to_dut2} | up
52 | | ${vxlan_dut1}= | Setup VXLAN on DUT | ${DUT1} | ${VNI} | ${dut1s_ip_address}
53 | | ...                                 | ${dut2s_ip_address} | ${dut1s_to_tg}
54 | | ...                                 | ${dut1s_to_dut2} | ${dut1s_ip_address}
55 | | ...                                 | ${duts_ip_address_prefix}
56 | | Set Suite Variable | ${vxlan_dut1}
57 | | ${vxlan_dut2}= | Setup VXLAN on DUT | ${DUT2} | ${VNI} | ${dut2s_ip_address}
58 | | ...                                 | ${dut1s_ip_address} | ${dut2s_to_tg}
59 | | ...                                 | ${dut2s_to_dut1} | ${dut2s_ip_address}
60 | | ...                                 | ${duts_ip_address_prefix}
61 | | Set Suite Variable | ${vxlan_dut2}
62 | | @{test_nodes}= | Create list | ${DUT1} | ${DUT2}
63 | | Vpp Nodes Interfaces Ready Wait | ${test_nodes}
64 # ip arp table must be filled on both nodes with neighbors address
65 | | VPP IP Probe | ${DUT1} | ${dut1s_to_dut2} | ${dut2s_ip_address}
66
67 | Setup DUT for VXLAN using BD
68 | | [Arguments] | ${DUT} | ${VNI} | ${INGRESS} | ${vxlan_if_index}
69 | | Create L2 BD | ${DUT} | ${VNI}
70 | | Add sw if index To L2 BD | ${DUT} | ${vxlan_if_index} | ${VNI}
71 | | Add Interface To L2 BD | ${DUT} | ${INGRESS} | ${VNI}
72
73 | Setup VXLAN on DUT
74 | | [Arguments] | ${DUT} | ${VNI} | ${SRC_IP} | ${DST_IP} | ${INGRESS}
75 | | ...         | ${EGRESS} | ${IP} | ${PREFIX}
76 | | Set Interface State | ${DUT} | ${EGRESS} | up
77 | | Set Interface State | ${DUT} | ${INGRESS} | up
78 | | Set Interface Address | ${DUT} | ${EGRESS} | ${IP} | ${PREFIX}
79 | | ${vxlan_if_index}= | Create VXLAN interface | ${DUT} | ${VNI} | ${SRC_IP}
80 | | ...                                         | ${DST_IP}
81 | | [Return] | ${vxlan_if_index}