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