VIRL test: eth2p-ethip4-ip4base-eth-2vhost-1vm
[csit.git] / tests / func / ipv4 / eth2p-ethip4-ip4base-eth-2vhost-1vm.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 | Force Tags | VM_ENV | HW_ENV | 3_NODE_DOUBLE_LINK_TOPO
31 | Test Setup | Func Test Setup
32 | Test Teardown | Func Test Teardown
33 | Documentation | *IPv4 routing test cases with vhost user interface*
34 | ...
35 | ... | RFC791 IPv4, RFC826 ARP, RFC792 ICMPv4. Encapsulations: Eth-IPv4-ICMPv4
36 | ... | on links TG=DUT1. IPv4 routing tests use circular 2-node
37 | ... | topology TG - DUT1 - TG with two link between the nodes. DUT is
38 | ... | configured with IPv4 routing and static routes. Test sends packets
39 | ... | by TG on links to DUT and received on TG link on the other side of
40 | ... | circular topology. On receive TG verifies packets IPv4 src-addr,
41 | ... | dst-addr and MAC addresses.
42
43 *** Variables ***
44 | ${net1}= | 10.0.1.0
45 | ${net3}= | 10.0.3.0
46 | ${net1_ip1}= | 10.0.1.1
47 | ${net1_ip2}= | 10.0.1.2
48 | ${net2_ip1}= | 10.0.2.1
49 | ${net2_ip2}= | 10.0.2.2
50 | ${net3_ip1}= | 10.0.3.1
51 | ${net3_ip2}= | 10.0.3.2
52 | ${prefix_length}= | 24
53 | ${fib_table_2}= | 20
54 | ${sock1}= | /tmp/sock1
55 | ${sock2}= | /tmp/sock2
56
57 *** Test Cases ***
58 | TC01: IPv4 forward via vhost to another VRF
59 | | [Documentation]
60 | | ... | Test uses VRF to route IPv4 traffic through 2 vhost user interfaces.
61 | | ... | Both have IP addresses from same network. On VM is set bridge to pass
62 | | ... | packet from a one vhost user interface to another one.
63 | | [Teardown] | Run Keywords
64 | | ... | Stop and Clear QEMU | ${dut_node} | ${vm_node} | AND
65 | | ... | Func Test Teardown
66 | |
67 | | Given Path for 2-node testing is set
68 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
69 | | And Interfaces in 2-node path are UP
70 | | ${vhost1}= | And Vpp Create Vhost User Interface | ${dut_node} | ${sock1}
71 | | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut_node} | ${sock2}
72 | | And Set Interface State | ${dut_node} | ${vhost1} | up
73 | | And Set Interface State | ${dut_node} | ${vhost2} | up
74 | | And Assign Interface To Fib Table | ${dut_node}
75 | | ... | ${vhost2} | ${fib_table_2}
76 | | And Assign Interface To Fib Table | ${dut_node}
77 | | ... | ${dut_to_tg_if2} | ${fib_table_2}
78 | | And IP addresses are set on interfaces
79 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_ip1} | ${prefix_length}
80 | | ... | ${dut_node} | ${vhost1} | ${net2_ip1} | ${prefix_length}
81 | | ... | ${dut_node} | ${vhost2} | ${net2_ip2} | ${prefix_length}
82 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${net3_ip1} | ${prefix_length}
83 | | ${vhost2_mac}= | And Get Vhost User Mac By SW Index
84 | | ... | ${dut_node} | ${vhost2}
85 | | And Vpp Route Add | ${dut_node} | ${net3} | 24 | ${net2_ip2}
86 | | ... | ${vhost1} | resolve_attempts=${NONE} | count=${NONE}
87 | | And Vpp Route Add | ${dut_node} | ${net1} | 24 | ${net2_ip1}
88 | | ... | ${vhost2} | resolve_attempts=${NONE} | count=${NONE}
89 | | ... | vrf=${fib_table_2}
90 | | Add IP Neighbor | ${dut_node} | ${vhost1} | ${net2_ip2} | ${vhost2_mac}
91 | | Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2} | ${net3_ip2}
92 | | ... | ${tg_to_dut_if2_mac} | vrf=${fib_table_2}
93 | | When VM for Vhost L2BD forwarding is setup
94 | | ... | ${dut_node} | ${sock1} | ${sock2}
95 | | Then Send Packet And Check Headers
96 | | ... | ${tg_node} | ${net1_ip2} | ${net3_ip2}
97 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_mac}
98 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if2_mac} | ${tg_to_dut_if2_mac}

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.