ebf5d351cac666e2500c0ce5b137e74284b8269f
[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 | Path for VXLAN testing is set
28 | | [Documentation] | *Compute path for VXLAN testing on nodes.*
29 | | ...
30 | | ... | _Set testcase variables with interfaces and nodes:_
31 | | ... | - ${tgs_to_dut1}
32 | | ... | - ${dut1s_to_tg}
33 | | ... | - ${tgs_to_dut2}
34 | | ... | - ${dut2s_to_tg}
35 | | ... | - ${dut1s_to_dut2}
36 | | ... | - ${dut2s_to_dut1}
37 | | ... | - ${tg}
38 | | ... | - ${dut1}
39 | | ... | - ${dut2}
40 | | ...
41 | | [Arguments] | ${TG} | ${DUT1} | ${DUT2}
42 | | Append Nodes | ${TG} | ${DUT1} | ${DUT2} | ${TG}
43 | | Compute Path
44 | | ${tgs_to_dut1} | ${tg}= | Next Interface
45 | | ${dut1s_to_tg} | ${dut1}= | Next Interface
46 | | ${dut1s_to_dut2} | ${dut1}= | Next Interface
47 | | ${dut2s_to_dut1} | ${dut2}= | Next Interface
48 | | ${dut2s_to_tg} | ${dut2}= | Next Interface
49 | | ${tgs_to_dut2} | ${tg}= | Next Interface
50 | | Set Test Variable | ${tgs_to_dut1}
51 | | Set Test Variable | ${dut1s_to_tg}
52 | | Set Test Variable | ${tgs_to_dut2}
53 | | Set Test Variable | ${dut2s_to_tg}
54 | | Set Test Variable | ${dut1s_to_dut2}
55 | | Set Test Variable | ${dut2s_to_dut1}
56 | | Set Test Variable | ${tg}
57 | | Set Test Variable | ${dut1}
58 | | Set Test Variable | ${dut2}
59
60 | Interfaces in path are up
61 | | [Documentation] | *Set UP state on interfaces in path on nodes.*
62 | | ...
63 | | Set Interface State | ${tg} | ${tgs_to_dut1} | up
64 | | Set Interface State | ${tg} | ${tgs_to_dut2} | up
65 | | Set Interface State | ${dut1} | ${dut1s_to_tg} | up
66 | | Set Interface State | ${dut1} | ${dut1s_to_dut2} | up
67 | | Set Interface State | ${dut2} | ${dut2s_to_tg} | up
68 | | Set Interface State | ${dut2} | ${dut2s_to_dut1} | up
69 | | Vpp Node Interfaces Ready Wait | ${dut1}
70 | | Vpp Node Interfaces Ready Wait | ${dut2}
71
72 | IP addresses are set on interfaces
73 | | [Documentation] | *Set IPv4 addresses on interfaces on DUTs.*
74 | | ... | If interface index is None then is determines with Get Interface Sw Index
75 | | ... | It also executes VPP IP Probe to determine MACs to IPs on DUTs
76 | | ...
77 | | ... | _Set testcase variables with IP addresses and prefix length:_
78 | | ... | - ${dut1s_ip_address}
79 | | ... | - ${dut2s_ip_address}
80 | | ... | - ${duts_ip_address_prefix}
81 | | ...
82 | | [Arguments] | ${DUT1} | ${DUT1_INT_NAME} | ${DUT1_INT_INDEX}
83 | | ...         | ${DUT2} | ${DUT2_INT_NAME} | ${DUT2_INT_INDEX}
84 | | Set Test Variable | ${dut1s_ip_address} | 172.16.0.1
85 | | Set Test Variable | ${dut2s_ip_address} | 172.16.0.2
86 | | Set Test Variable | ${duts_ip_address_prefix} | 24
87 | | ${DUT1_INT_INDEX}= | Run Keyword If | ${DUT1_INT_INDEX} is None
88 | |                    | ... | Get Interface Sw Index | ${DUT1} | ${DUT1_INT_NAME}
89 | |                    | ... | ELSE | Set Variable | ${DUT1_INT_INDEX}
90 | | ${DUT2_INT_INDEX}= | Run Keyword If | ${DUT2_INT_INDEX} is None
91 | |                    | ... | Get Interface Sw Index | ${DUT2} | ${DUT2_INT_NAME}
92 | |                    | ... | ELSE | Set Variable | ${DUT2_INT_INDEX}
93 | | Set Interface Address | ${DUT1} | ${DUT1_INT_INDEX}
94 | | ... | ${dut1s_ip_address} | ${duts_ip_address_prefix}
95 | | Set Interface Address | ${DUT2} | ${DUT2_INT_INDEX}
96 | | ... | ${dut2s_ip_address} | ${duts_ip_address_prefix}
97 | | VPP IP Probe | ${DUT1} | ${DUT1_INT_NAME} | ${dut2s_ip_address}
98 | | VPP IP Probe | ${DUT2} | ${DUT2_INT_NAME} | ${dut1s_ip_address}
99
100 | VXLAN interface is created
101 | | [Arguments] | ${DUT} | ${VNI} | ${SRC_IP} | ${DST_IP}
102 | | Create VXLAN interface | ${DUT} | ${VNI} | ${SRC_IP} | ${DST_IP}
103
104 | Interfaces are added to BD
105 | | [Arguments] | ${DUT} | ${BID} | ${INTERFACE_1} | ${INTERFACE_2}
106 | | Vpp Add L2 Bridge Domain | ${DUT} | ${BID} | ${INTERFACE_1} | ${INTERFACE_2}
107
108 | Interfaces are added to xconnect
109 | | [Arguments] | ${DUT} | ${INTERFACE_1} | ${INTERFACE_2}
110 | |  L2 setup xconnect on DUT | ${DUT} | ${INTERFACE_1} | ${INTERFACE_2}
111
112 | Vlan interfaces for VXLAN are created
113 | | [Documentation] | *Create VLAN subinterface on interfaces on DUTs with given VLAN ID.*
114 | | ...
115 | | ... | _Set testcase variables with name and index of created interfaces:_
116 | | ... | - ${dut1s_vlan_name}
117 | | ... | - ${dut1s_vlan_index}
118 | | ... | - ${dut2s_vlan_name}
119 | | ... | - ${dut2s_vlan_index}
120 | | ...
121 | | [Arguments] | ${VLAN} | ${DUT1} | ${INT1} | ${DUT2} | ${INT2}
122 | | ${dut1s_vlan_name} | ${dut1s_vlan_index}= | Create Vlan Subinterface
123 | |                    | ...                  | ${DUT1} | ${INT1} | ${VLAN}
124 | | ${dut2s_vlan_name} | ${dut2s_vlan_index}= | Create Vlan Subinterface
125 | |                    | ...                  | ${DUT2} | ${INT2} | ${VLAN}
126 | | Set Interface State | ${DUT1} | ${dut1s_vlan_index} | up
127 | | Set Interface State | ${DUT2} | ${dut2s_vlan_index} | up
128 | | Set Test Variable | ${dut1s_vlan_name}
129 | | Set Test Variable | ${dut1s_vlan_index}
130 | | Set Test Variable | ${dut2s_vlan_name}
131 | | Set Test Variable | ${dut2s_vlan_index}