e97ccaf1fbde922dca8de59d0fc7e867497863b3
[csit.git] / tests / vpp / device / interfaces / eth2p-ethip4-ip4base-eth-1tap-dev.robot
1 # Copyright (c) 2019 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 | Resource | resources/libraries/robot/shared/default.robot
16 | Resource | resources/libraries/robot/ip/ip4.robot
17 | Resource | resources/libraries/robot/ip/ip6.robot
18 | Resource | resources/libraries/robot/shared/interfaces.robot
19 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
20 | Resource | resources/libraries/robot/shared/testing_path.robot
21 | Resource | resources/libraries/robot/shared/traffic.robot
22 | Library  | resources.libraries.python.Trace
23 | Library  | resources.libraries.python.Tap
24 | Library  | resources.libraries.python.Namespaces
25 | Library  | resources.libraries.python.IPUtil
26 | ...
27 | Force Tags | 2_NODE_SINGLE_LINK_TOPO | DEVICETEST | HW_ENV | DCR_ENV
28 | ... | FUNCTEST | IP4FWD | BASE | ETH | IP4BASE | TAP
29 | ...
30 | Test Setup | Run Keywords | Set up VPP device test
31 | ... | AND | Clean Up Namespaces | ${nodes['DUT1']}
32 | ...
33 | Test Teardown | Run Keywords | Tear down VPP device test
34 | ... | AND | Clean Up Namespaces | ${nodes['DUT1']}
35 | ...
36 | Documentation | *Tap Interface Traffic Tests*
37 | ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
38 | ... | between nodes.
39 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for L2 switching of
40 | ... | IPv4.
41 | ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with L2
42 | ... | bridge-domain (L2BD) MAC learning enabled; Split Horizon Groups (SHG)
43 | ... | are set depending on test case; Namespaces (NM)
44 | ... | are set on DUT1 with attached linux-TAP.
45 | ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets
46 | ... | are sent by TG on link to DUT1; On receipt TG verifies packets
47 | ... | for correctness and their IPv4 src-addr, dst-addr, and MAC addresses.
48 | ... | *[Ref] Applicable standard specifications:*
49
50 *** Variables ***
51 | ${tap1_VPP_ip}= | 16.0.10.1
52 | ${tap1_NM_ip}= | 16.0.10.2
53 | ${tap1_NM_mac}= | 02:00:00:00:00:02
54 | ${tap_int1}= | tap0
55
56 | ${namespace1}= | nmspace1
57
58 | ${dut_ip_address}= | 192.168.0.1
59 | ${tg_ip_address}= | 192.168.0.2
60 | ${tg_ip_address_GW}= | 192.168.0.0
61 | ${prefix}= | 24
62
63 *** Test Cases ***
64 | tc01-eth2p-ethicmpv4-ip4base-device_tap-no-namespace
65 | | [Documentation]
66 | | ... | [Cfg] On DUT1 configure two interface addresses with IPv4 of which\
67 | | ... | one is TAP interface (dut_to_tg_if and TAP) and one is linux-TAP.
68 | | ... | [Ver] Packet sent from TG gets to the destination and ICMP-reply is\
69 | | ... | received on TG.
70 | | ...
71 | | Given Configure path in 2-node circular topology | ${nodes['TG']}
72 | | ... | ${nodes['DUT1']} | ${nodes['TG']}
73 | | And Set interfaces in 2-node circular topology up
74 | | ${int1}= | And Add Tap Interface | ${dut_node} | ${tap_int1} |
75 | | And Set Interface Address
76 | | ... | ${dut_node} | ${int1} | ${tap1_VPP_ip} | ${prefix}
77 | | And Set Interface Address
78 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip_address} | ${prefix}
79 | | And Set Interface State | ${dut_node} | ${int1} | up
80 | | And Set Linux Interface MAC | ${dut_node} | ${tap_int1} | ${tap1_NM_mac}
81 | | And Set Linux Interface IP | ${dut_node}
82 | | ... | ${tap_int1} | ${tap1_NM_ip} | ${prefix}
83 | | And Add Route | ${dut_node}
84 | | ... | ${tg_ip_address_GW} | ${prefix} | ${tap1_VPP_ip}
85 | | And Add Arp On Dut | ${dut_node} | ${dut_to_tg_if1}
86 | | ... | ${tg_ip_address} | ${tg_to_dut_if1_mac}
87 | | And Add Arp On Dut | ${dut_node} | ${int1}
88 | | ... | ${tap1_NM_ip} | ${tap1_NM_mac}
89 | | Then Send ICMP echo request and verify answer | ${tg_node}
90 | | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac} | ${tg_to_dut_if1_mac}
91 | | ... | ${tap1_NM_ip} | ${tg_ip_address}
92
93 | tc02-eth2p-ethicmpv4-ip4base-device_tap-namespace
94 | | [Documentation]
95 | | ... | [Cfg] On DUT1 configure two interface addresses with IPv4 of which\
96 | | ... | one is TAP interface (dut_to_tg_if and TAP) and one is linux-TAP in\
97 | | ... | namespace.
98 | | ... | [Ver] Packet sent from TG gets to the destination and ICMP-reply is\
99 | | ... | received on TG.
100 | | ...
101 | | Given Configure path in 2-node circular topology | ${nodes['TG']}
102 | | ... | ${nodes['DUT1']} | ${nodes['TG']}
103 | | And Set interfaces in 2-node circular topology up
104 | | ${int1}= | And Add Tap Interface | ${dut_node} | ${tap_int1} |
105 | | And Set Interface Address
106 | | ... | ${dut_node} | ${int1} | ${tap1_VPP_ip} | ${prefix}
107 | | And Set Interface Address
108 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip_address} | ${prefix}
109 | | And Set Interface State | ${dut_node} | ${int1} | up
110 | | When Create Namespace | ${dut_node} | ${namespace1}
111 | | And Attach Interface To Namespace | ${dut_node}
112 | | ... | ${namespace1} | ${tap_int1}
113 | | And Set Linux Interface MAC | ${dut_node}
114 | | ... | ${tap_int1} | ${tap1_NM_mac} | ${namespace1}
115 | | And Set Linux Interface IP | ${dut_node}
116 | | ... | ${tap_int1} | ${tap1_NM_ip} | ${prefix} | ${namespace1}
117 | | And Add Arp On Dut | ${dut_node} | ${dut_to_tg_if1}
118 | | ... | ${tg_ip_address} | ${tg_to_dut_if1_mac}
119 | | And Add Arp On Dut | ${dut_node} | ${int1}
120 | | ... | ${tap1_NM_ip} | ${tap1_NM_mac}
121 | | And Add Route | ${dut_node}
122 | | ... | ${tg_ip_address_GW} | ${prefix} | ${tap1_VPP_ip} | ${namespace1}
123 | | Then Send ICMP echo request and verify answer | ${tg_node}
124 | | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac} | ${tg_to_dut_if1_mac}
125 | | ... | ${tap1_NM_ip} | ${tg_ip_address}