CSIT-1459: Migrate IP libraries from VAT to PAPI
[csit.git] / tests / vpp / func / ip4 / eth2p-ethip4-ip4base-ip4dhcpproxy-func.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 | Library | resources.libraries.python.Trace
16 | ...
17 | Resource | resources/libraries/robot/ip/ip4.robot
18 | Resource | resources/libraries/robot/features/dhcp_proxy.robot
19 | Resource | resources/libraries/robot/shared/default.robot
20 | Resource | resources/libraries/robot/shared/testing_path.robot
21 | ...
22 | Force Tags | HW_ENV | VM_ENV | 3_NODE_DOUBLE_LINK_TOPO | SKIP_VPP_PATCH
23 | ...
24 | Test Setup | Set up functional test
25 | ...
26 | Test Teardown | Tear down functional test
27 | ...
28 | Documentation | *DHCPv4 proxy test cases*
29 | ...
30 | ... | *[Top] Network Topologies:* TG = DUT
31 | ... |        with two links between the nodes.
32 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-UDP-BOOTP-DHCP
33 | ... | *[Cfg] DUT configuration:* DUT is configured with DHCPv4 proxy.
34 | ... | *[Ver] TG verification:* Test DHCPv4 packets are sent
35 | ... |        on TG on first link to DUT and received on TG on second link.
36 | ... |        On receive TG verifies if DHCPv4 packets are valid.
37
38 *** Variables ***
39 | ${dut_to_tg_if1_ip}= | 172.16.0.1
40 | ${dut_to_tg_if2_ip}= | 192.168.0.1
41 | ${dhcp_server_ip}= | 192.168.0.100
42 | ${client_ip}= | 172.16.0.2
43 | ${prefix_length}= | 24
44
45 | ${discover_src_ip}= | 0.0.0.0
46 | ${valid_discover_dst_ip}= | 255.255.255.255
47 | ${invalid_discover_dst_ip}= | 255.255.255.1
48
49 *** Test Cases ***
50 | TC01: VPP proxies valid DHCPv4 request to DHCPv4 server
51 | | [Documentation] |
52 | | ... | [Top] TG=DUT \
53 | | ... | [Enc] Eth-IPv4-UDP-BOOTP-DHCP
54 | | ... | [Cfg] On DUT setup DHCPv4 proxy.
55 | | ... | [Ver] Make TG verify matching DHCPv4 packets between client and DHCPv4
56 | | ... | server through DHCP proxy.
57 | | ...
58 | | Given Configure path in 2-node circular topology
59 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
60 | | And Set interfaces in 2-node circular topology up
61 | | And VPP Route Add | ${dut_node} | 255.255.255.255 | 32 | local=${True}
62 | | And VPP Interface Set IP Address | ${dut_node}
63 | | ... | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip} | ${prefix_length}
64 | | And VPP Interface Set IP Address | ${dut_node}
65 | | ... | ${dut_to_tg_if2} | ${dut_to_tg_if2_ip} | ${prefix_length}
66 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2} | ${dhcp_server_ip}
67 | | ... | ${tg_to_dut_if2_mac}
68 | | When DHCP Proxy Config | ${dut_node} | ${dhcp_server_ip}
69 | | ... | ${dut_to_tg_if1_ip}
70 | | Then Send DHCP messages and check answer | ${tg_node} | ${tg_to_dut_if1}
71 | | ... | ${tg_to_dut_if2} | ${dhcp_server_ip} | ${tg_to_dut_if2_mac}
72 | | ... | ${client_ip} | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_ip}
73
74 | TC02: VPP proxy ignores invalid DHCPv4 request
75 | | [Documentation] |
76 | | ... | [Top] TG=DUT \
77 | | ... | [Enc] Eth-IPv4-UDP-BOOTP-DHCP
78 | | ... | [Cfg] On DUT setup DHCPv4 proxy.
79 | | ... | [Ver] Make TG verify matching invalid DHCPv4 packets are dropped.
80 | | ...
81 | | Given Configure path in 2-node circular topology
82 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
83 | | And Set interfaces in 2-node circular topology up
84 | | And VPP Route Add | ${dut_node} | 255.255.255.255 | 32 | local=${True}
85 | | And VPP Interface Set IP Address | ${dut_node}
86 | | ... | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip} | ${prefix_length}
87 | | And VPP Interface Set IP Address | ${dut_node}
88 | | ... | ${dut_to_tg_if2} | ${dut_to_tg_if2_ip} | ${prefix_length}
89 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2} | ${dhcp_server_ip}
90 | | ... | ${tg_to_dut_if2_mac}
91 | | When DHCP Proxy Config | ${dut_node} | ${dhcp_server_ip}
92 | | ... | ${dut_to_tg_if1_ip}
93 | | Then Send DHCP DISCOVER and check answer | ${tg_node} | ${tg_to_dut_if1}
94 | | ... | ${tg_to_dut_if2} | ${discover_src_ip} | ${valid_discover_dst_ip}
95 | | And DHCP DISCOVER should fail | ${tg_node} | ${tg_to_dut_if1}
96 | | ... | ${tg_to_dut_if2} | ${discover_src_ip} | ${invalid_discover_dst_ip}