CSIT-664: Refactor setups and teardowns
[csit.git] / tests / func / lisp / eth2p-ethip4lispgpe-ip4basevrf-eth-2vhost-1vm-func.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 | resources.libraries.python.topology.Topology
16 | Library | resources.libraries.python.NodePath
17 | Library | resources.libraries.python.Trace
18 | Library | resources.libraries.python.IPUtil
19 | Library | resources.libraries.python.VPPUtil
20 | Library | resources.libraries.python.InterfaceUtil
21 | Library | resources.libraries.python.VhostUser
22 | Resource | resources/libraries/robot/traffic.robot
23 | Resource | resources/libraries/robot/default.robot
24 | Resource | resources/libraries/robot/interfaces.robot
25 | Resource | resources/libraries/robot/testing_path.robot
26 | Resource | resources/libraries/robot/ipv4.robot
27 | Resource | resources/libraries/robot/vrf.robot
28 | Resource | resources/libraries/robot/qemu.robot
29 | Resource | resources/libraries/robot/bridge_domain.robot
30 | Resource | resources/libraries/robot/lisp/lispgpe.robot
31 # Import configuration and test data:
32 | Variables | resources/test_data/lisp/ipv4_lispgpe_ipv4/ipv4_lispgpe_ipv4.py
33 | ...
34 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP
35 | ...
36 | Test Setup | Set up functional test
37 | ...
38 | Test Teardown | Tear down LISP functional test with QEMU | ${vm_node}
39 | ...
40 | Documentation | *ip4-lispgpe-ip4 encapsulation test cases*
41 | ...
42 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
43 | ... | with single links between nodes.
44 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-LISP-IPv4-ICMPv4 on DUT1-DUT2,\
45 | ... | Eth-IPv4-ICMPv4 on TG-DUTn for IPv4 routing over LISPoIPv4 tunnel.
46 | ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with IPv4\
47 | ... | routing and static routes. LISPoIPv4 tunnel is configured between\
48 | ... | DUT1 and DUT2.
49 | ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets are sent in\
50 | ... | both directions by TG on links to DUT1 and DUT2; on receive\
51 | ... | TG verifies packets for correctness and their IPv4 src-addr, dst-addr\
52 | ... | and MAC addresses.
53 | ... | *[Ref] Applicable standard specifications:* RFC6830.
54
55 *** Test Cases ***
56 | TC01: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using vhost interfaces and VRF is enabled
57 | | [Documentation]
58 | | ... | [Top] TG-DUT1-DUT2-TG.
59 | | ... | [Enc] Eth-IPv4-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2, Eth-IPv4-ICMPv4 on\
60 | | ... | TG-DUTn.
61 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2.
62 | | ... | [Ver] Case: ip4-lispgpe-ip4 - vrf, virt2lisp
63 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
64 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
65 | | ... | received packets are correct.
66 | | ... | [Ref] RFC6830.
67 | | ...
68 | | Given Configure path in 3-node circular topology
69 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
70 | | And Set interfaces in 3-node circular topology up
71 | | And Assign Interface To Fib Table | ${dut1_node}
72 | | ... | ${dut1_to_tg} | ${fib_table_1}
73 | | And Assign Interface To Fib Table | ${dut2_node}
74 | | ... | ${dut2_to_tg} | ${fib_table_1}
75 | | And Add IP Neighbors
76 | | And Configure IP addresses on interfaces
77 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4} | ${prefix4}
78 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${prefix4}
79 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4} | ${prefix4}
80 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4} | ${prefix4}
81 | | When Configure LISP GPE topology in 3-node circular topology
82 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
83 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
84 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
85 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
86 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
87 | | ... | ${dut1_dut2_vni} | ${fib_table_1}
88 | | And Setup Qemu DUT1 | ${fib_table_1}
89 | | Then Send packet and verify headers
90 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
91 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
92 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
93 | | And Send packet and verify headers
94 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
95 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
96 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
97
98 *** Keywords ***
99 | Setup Qemu DUT1
100 | | [Documentation] | Setup Vhosts on DUT1 and setup IP on one of them. Setup\
101 | | ... | Qemu and bridge the vhosts. Optionally, you can set fib table ID\
102 | | ... | where the vhost2 interface should be assigned to.
103 | | ...
104 | | [Arguments] | ${fib_table}=0
105 | | ...
106 | | ${vhost1}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
107 | | ${vhost2}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
108 | | Assign Interface To Fib Table | ${dut1_node}
109 | | ... | ${vhost2} | ${fib_table}
110 | | Set Interface Address | ${dut1_node} | ${vhost2} | ${vhost_ip} | ${prefix4}
111 | | Set Interface State | ${dut1_node} | ${vhost1} | up
112 | | Set Interface State | ${dut1_node} | ${vhost2} | up
113 | | Create bridge domain | ${dut1_node} | ${bid} | learn=${TRUE}
114 | | Add interface to bridge domain | ${dut1_node}
115 | | ... | ${dut1_to_tg} | ${bid} | 0
116 | | Add interface to bridge domain | ${dut1_node}
117 | | ... | ${vhost1} | ${bid} | 0
118 | | ${vhost_mac}= | Get Vhost User Mac By SW Index | ${dut1_node} | ${vhost2}
119 | | Set test variable | ${dst_vhost_mac} | ${vhost_mac}
120 | | Configure VM for vhost L2BD forwarding | ${dut1_node} | ${sock1} | ${sock2}
121
122 | Add IP Neighbors
123 | | [Documentation]
124 | | ... | Add IP neighbors to physical interfaces on DUTs.
125 | | ...
126 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip4}
127 | | ... | ${tg_to_dut1_mac}
128 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip4}
129 | | ... | ${tg_to_dut2_mac}
130 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip4}
131 | | ... | ${dut2_to_dut1_mac}
132 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip4}
133 | | ... | ${dut1_to_dut2_mac}