VIRL test: Replace IP probe for VXLAN test
[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/interfaces.robot
18 | Resource | resources/libraries/robot/bridge_domain.robot
19 | Resource | resources/libraries/robot/l2_xconnect.robot
20 | Library  | resources.libraries.python.L2Util
21 | Library  | resources.libraries.python.IPUtil
22 | Library  | resources.libraries.python.IPv4Util
23 | Library  | resources.libraries.python.IPv6Util
24 | Library  | resources.libraries.python.IPv4Setup
25 | Library  | resources.libraries.python.NodePath
26
27 *** Keywords ***
28 | IP addresses are set on interfaces
29 | | [Documentation] | *Set IPv4 addresses on interfaces on DUTs.*
30 | | ... | If interface index is None then is determines with Get Interface Sw Index
31 | | ... | in this case it is required the interface to be present in topology dict.
32 | | ... | It also executes VPP IP Probe to determine MACs to IPs on DUTs
33 | | ...
34 | | ... | _Set testcase variables with IP addresses and prefix length:_
35 | | ... | - ${dut1s_ip_address}
36 | | ... | - ${dut2s_ip_address}
37 | | ... | - ${duts_ip_address_prefix}
38 | | ...
39 | | [Arguments] | ${DUT1} | ${DUT1_INT_NAME} | ${DUT1_INT_INDEX}
40 | | ...         | ${DUT2} | ${DUT2_INT_NAME} | ${DUT2_INT_INDEX}
41 | | Set Test Variable | ${dut1s_ip_address} | 172.16.0.1
42 | | Set Test Variable | ${dut2s_ip_address} | 172.16.0.2
43 | | Set Test Variable | ${duts_ip_address_prefix} | 24
44 | | ${DUT1_INT_KEY}= | Run Keyword If | ${DUT1_INT_INDEX} is None
45 | |                  | ... | Get Interface by name | ${DUT1} | ${DUT1_INT_NAME}
46 | | ${DUT2_INT_KEY}= | Run Keyword If | ${DUT2_INT_INDEX} is None
47 | |                  | ... | Get Interface by name | ${DUT2} | ${DUT2_INT_NAME}
48 | | ${DUT1_INT_INDEX}= | Run Keyword If | ${DUT1_INT_INDEX} is None
49 | |                    | ... | Get Interface Sw Index | ${DUT1} | ${DUT1_INT_KEY}
50 | |                    | ... | ELSE | Set Variable | ${DUT1_INT_INDEX}
51 | | ${DUT2_INT_INDEX}= | Run Keyword If | ${DUT2_INT_INDEX} is None
52 | |                    | ... | Get Interface Sw Index | ${DUT2} | ${DUT2_INT_KEY}
53 | |                    | ... | ELSE | Set Variable | ${DUT2_INT_INDEX}
54 | | ${DUT1_INT_MAC}= | Vpp Get Interface Mac | ${DUT1} | ${DUT1_INT_INDEX}
55 | | ${DUT2_INT_MAC}= | Vpp Get Interface Mac | ${DUT2} | ${DUT2_INT_INDEX}
56 | | Set Interface Address | ${DUT1} | ${DUT1_INT_INDEX}
57 | | ... | ${dut1s_ip_address} | ${duts_ip_address_prefix}
58 | | Set Interface Address | ${DUT2} | ${DUT2_INT_INDEX}
59 | | ... | ${dut2s_ip_address} | ${duts_ip_address_prefix}
60 | | Add IP Neighbor | ${DUT1} | ${DUT1_INT_INDEX} | ${dut2s_ip_address} | ${DUT2_INT_MAC}
61 | | Add IP Neighbor | ${DUT2} | ${DUT2_INT_INDEX} | ${dut1s_ip_address} | ${DUT1_INT_MAC}
62
63 | VXLAN interface is created
64 | | [Arguments] | ${DUT} | ${VNI} | ${SRC_IP} | ${DST_IP}
65 | | Create VXLAN interface | ${DUT} | ${VNI} | ${SRC_IP} | ${DST_IP}
66
67 | Interfaces are added to BD
68 | | [Arguments] | ${DUT} | ${BID} | ${INTERFACE_1} | ${INTERFACE_2}
69 | | Vpp Add L2 Bridge Domain | ${DUT} | ${BID} | ${INTERFACE_1} | ${INTERFACE_2}
70
71 | Interfaces are added to xconnect
72 | | [Arguments] | ${DUT} | ${INTERFACE_1} | ${INTERFACE_2}
73 | | L2 setup xconnect on DUT | ${DUT} | ${INTERFACE_1} | ${INTERFACE_2}
74
75 | Vlan interfaces for VXLAN are created
76 | | [Documentation] | *Create VLAN subinterface on interfaces on DUTs with given VLAN ID.*
77 | | ...
78 | | ... | _Set testcase variables with name and index of created interfaces:_
79 | | ... | - ${dut1s_vlan_name}
80 | | ... | - ${dut1s_vlan_index}
81 | | ... | - ${dut2s_vlan_name}
82 | | ... | - ${dut2s_vlan_index}
83 | | ...
84 | | [Arguments] | ${VLAN} | ${DUT1} | ${INT1} | ${DUT2} | ${INT2}
85 | | ${INT1_NAME}= | Get interface name | ${DUT1} | ${INT1}
86 | | ${INT2_NAME}= | Get interface name | ${DUT2} | ${INT2}
87 | | ${dut1s_vlan_name} | ${dut1s_vlan_index}= | Create Vlan Subinterface
88 | |                    | ...                  | ${DUT1} | ${INT1_NAME} | ${VLAN}
89 | | ${dut2s_vlan_name} | ${dut2s_vlan_index}= | Create Vlan Subinterface
90 | |                    | ...                  | ${DUT2} | ${INT2_NAME} | ${VLAN}
91 | | Set Interface State | ${DUT1} | ${dut1s_vlan_index} | up
92 | | Set Interface State | ${DUT2} | ${dut2s_vlan_index} | up
93 | | Set Test Variable | ${dut1s_vlan_name}
94 | | Set Test Variable | ${dut1s_vlan_index}
95 | | Set Test Variable | ${dut2s_vlan_name}
96 | | Set Test Variable | ${dut2s_vlan_index}