e38c678d2b728144753d9486377b3b2c423ae2ee
[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 | Library  | resources.libraries.python.L2Util
19 | Library  | resources.libraries.python.IPUtil
20 | Library  | resources.libraries.python.IPv4Util
21 | Library  | resources.libraries.python.IPv4Setup
22 | Library  | resources.libraries.python.InterfaceSetup
23 | Library  | resources.libraries.python.InterfaceUtil
24 | Library  | resources.libraries.python.topology.Topology
25 | Library  | resources.libraries.python.NodePath
26
27
28 *** Keywords ***
29 | Setup VXLAN tunnel on nodes
30 | | [Arguments] | ${TG} | ${DUT1} | ${DUT2} | ${VNI}
31 | | Append Nodes | ${TG} | ${DUT1} | ${DUT2} | ${TG}
32 | | Compute Path
33 | | ${tgs_to_dut1} | ${tg}= | Next Interface
34 | | ${dut1s_to_tg} | ${dut1}= | Next Interface
35 | | ${dut1s_to_dut2} | ${dut1}= | Next Interface
36 | | ${dut2s_to_dut1} | ${dut2}= | Next Interface
37 | | ${dut2s_to_tg} | ${dut2}= | Next Interface
38 | | ${tgs_to_dut2} | ${tg}= | Next Interface
39 | | Set Suite Variable | ${tgs_to_dut1}
40 | | Set Suite Variable | ${dut1s_to_tg}
41 | | Set Suite Variable | ${tgs_to_dut2}
42 | | Set Suite Variable | ${dut2s_to_tg}
43 | | Set Suite Variable | ${dut1s_to_dut2}
44 | | Set Suite Variable | ${dut2s_to_dut1}
45 # TODO: replace with address generator
46 | | Set Suite Variable | ${dut1s_ip_address} | 172.16.0.1
47 | | Set Suite Variable | ${dut2s_ip_address} | 172.16.0.2
48 | | Set Suite Variable | ${duts_ip_address_prefix} | 24
49 | | Set Interface State | ${TG} | ${tgs_to_dut1} | up
50 | | Set Interface State | ${TG} | ${tgs_to_dut2} | up
51 | | Setup DUT for VXLAN | ${DUT1} | ${VNI} | ${dut1s_ip_address} | ${dut2s_ip_address}
52 | | ...                 | ${dut1s_to_tg} | ${dut1s_to_dut2} | ${dut1s_ip_address} | ${duts_ip_address_prefix}
53 | | Setup DUT for VXLAN | ${DUT2} | ${VNI} | ${dut2s_ip_address} | ${dut1s_ip_address}
54 | | ...                 | ${dut2s_to_tg} | ${dut2s_to_dut1} | ${dut2s_ip_address} | ${duts_ip_address_prefix}
55 | | @{test_nodes}= | Create list | ${DUT1} | ${DUT2}
56 | | Vpp Nodes Interfaces Ready Wait | ${test_nodes}
57 # ip arp table must be filled on both nodes with neighbors address
58 | | VPP IP Probe | ${DUT1} | ${dut1s_to_dut2} | ${dut2s_ip_address}
59
60 | Setup DUT for VXLAN
61 | | [Arguments] | ${DUT} | ${VNI} | ${SRC_IP} | ${DST_IP} | ${INGRESS} | ${EGRESS} | ${IP} | ${PREFIX}
62 | | Set Interface State | ${DUT} | ${EGRESS} | up
63 | | Set Interface State | ${DUT} | ${INGRESS} | up
64 | | Node "${DUT}" interface "${EGRESS}" has IPv4 address "${IP}" with prefix length "${PREFIX}"
65 | | ${vxlan_if_index}= | Create VXLAN interface on "${DUT}" with VNI "${VNI}" from "${SRC_IP}" to "${DST_IP}"
66 | | Create L2 BD | ${DUT} | ${VNI}
67 | | Add sw if index To L2 BD | ${DUT} | ${vxlan_if_index} | ${VNI}
68 | | Add Interface To L2 BD | ${DUT} | ${INGRESS} | ${VNI}