62532d30777b5d303ad892339574c9a42975705c
[csit.git] / tests / func / dhcp / dhcp_v4_proxy.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 | Resource | resources/libraries/robot/default.robot
16 | Resource | resources/libraries/robot/testing_path.robot
17 | Resource | resources/libraries/robot/dhcp_client.robot
18 | Resource | resources/libraries/robot/ipv4.robot
19 | Library | resources.libraries.python.Trace
20 | Force Tags | HW_ENV | VM_ENV | 3_NODE_DOUBLE_LINK_TOPO
21 | Test Setup | Run Keywords | Setup all DUTs before test
22 | ...        | AND          | Setup all TGs before traffic script
23 | Test Teardown | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
24 | ...           | AND          | Show vpp trace dump on all DUTs
25 | Documentation | *DHCP proxy test cases*
26 | ...
27 | ... | *[Top] Network Topologies:* TG = DUT
28 | ... |        with two links between the nodes.
29 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-UDP-BOOTP-DHCP
30 | ... | *[Cfg] DUT configuration:* DUT is configured with DHCP proxy.
31 | ... | *[Ver] TG verification:* Test DHCP packets are sent
32 | ... |        on TG on first link to DUT and received on TG on second link.
33 | ... |        On receive TG verifies if DHCP packets are valid.
34
35 *** Variables ***
36 | ${dut_to_tg_if1_ip}= | 172.16.0.1
37 | ${dut_to_tg_if2_ip}= | 192.168.0.1
38 | ${dhcp_server_ip}= | 192.168.0.100
39 | ${client_ip}= | 172.16.0.2
40 | ${prefix_length}= | 24
41
42 | ${discover_src_ip}= | 0.0.0.0
43 | ${valid_discover_dst_ip}= | 255.255.255.255
44 | ${invalid_discover_dst_ip}= | 255.255.255.1
45
46 *** Test Cases ***
47 | TC01: VPP proxies valid DHCPv4 request to DHCPv4 server
48 | | [Documentation] |
49 | | ... | [Top] TG=DUT \
50 | | ... | [Enc] Eth-IPv4-UDP-BOOTP-DHCP
51 | | ... | [Cfg] On DUT setup DHCP proxy.
52 | | ... | [Ver] Make TG verify matching DHCP packets between client and DHCP
53 | | ... | server through DHCP proxy.
54 | | ...
55 | | Given Path for 2-node testing is set
56 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
57 | | And Interfaces in 2-node path are up
58 | | And VPP Route Add | ${dut_node} | 255.255.255.255 | 32 | ${NONE} | local
59 | | ... | ${FALSE} | ${NONE}
60 | | And Set Interface Address | ${dut_node}
61 | | ... | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip} | ${prefix_length}
62 | | And Set Interface Address | ${dut_node}
63 | | ... | ${dut_to_tg_if2} | ${dut_to_tg_if2_ip} | ${prefix_length}
64 | | And Add Arp On Dut | ${dut_node} | ${dut_to_tg_if2} | ${dhcp_server_ip}
65 | | ... | ${tg_to_dut_if2_mac}
66 | | When DHCP Proxy Config | ${dut_node} | ${dhcp_server_ip}
67 | | ... | ${dut_to_tg_if1_ip}
68 | | Then Send DHCP Messages | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
69 | | ... | ${dhcp_server_ip} | ${tg_to_dut_if2_mac} | ${client_ip}
70 | | ... | ${tg_to_dut_if1_mac} | ${dut_to_tg_if1_ip}
71
72 | TC02: VPP proxy ignores invalid DHCPv4 request
73 | | [Documentation] |
74 | | ... | [Top] TG=DUT \
75 | | ... | [Enc] Eth-IPv4-UDP-BOOTP-DHCP
76 | | ... | [Cfg] On DUT setup DHCP proxy.
77 | | ... | [Ver] Make TG verify matching invalid DHCP packets are dropped.
78 | | ...
79 | | Given Path for 2-node testing is set
80 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
81 | | And Interfaces in 2-node path are up
82 | | And VPP Route Add | ${dut_node} | 255.255.255.255 | 32 | ${NONE} | local
83 | | ... | ${FALSE} | ${NONE}
84 | | And Set Interface Address | ${dut_node}
85 | | ... | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip} | ${prefix_length}
86 | | And Set Interface Address | ${dut_node}
87 | | ... | ${dut_to_tg_if2} | ${dut_to_tg_if2_ip} | ${prefix_length}
88 | | And Add Arp On Dut | ${dut_node} | ${dut_to_tg_if2} | ${dhcp_server_ip}
89 | | ... | ${tg_to_dut_if2_mac}
90 | | When DHCP Proxy Config | ${dut_node} | ${dhcp_server_ip}
91 | | ... | ${dut_to_tg_if1_ip}
92 | | Then Send DHCP DISCOVER | ${tg_node} | ${tg_to_dut_if1}
93 | | ... | ${tg_to_dut_if2} | ${discover_src_ip} | ${valid_discover_dst_ip}
94 | | And Send DHCP DISCOVER should fail | ${tg_node} | ${tg_to_dut_if1}
95 | | ... | ${tg_to_dut_if2} | ${discover_src_ip} | ${invalid_discover_dst_ip}