CSIT-1459: Migrate IP libraries from VAT to PAPI
[csit.git] / tests / vpp / func / ip4 / eth2p-ethip4-ip4base-ip4dhcpclient-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_client.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 Client related test cases
29
30 *** Variables ***
31 | ${client_hostname}= | dhcp-client
32 | ${client_ip}= | 192.168.23.10
33 | ${client_mask}= | 255.255.255.0
34 | ${server_ip}= | 192.168.23.1
35 | ${own_xid}= | 11112222
36 | ${lease_time}= | ${15}
37
38 *** Test Cases ***
39 | TC01: VPP sends a DHCP DISCOVER
40 | | [Documentation] | Configure DHCPv4 client on interface to TG without
41 | | ... | hostname and check if DHCPv4 DISCOVER message contains all
42 | | ... | required fields with expected values.
43 | | ...
44 | | Given Configure path in 2-node circular topology
45 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
46 | | And Set interfaces in 2-node circular topology up
47 | | When Set DHCP client on Interface | ${dut_node} | ${dut_to_tg_if1}
48 | | Then Verify DHCP DISCOVER header | ${tg_node}
49 | | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac}
50
51 | TC02: VPP sends a DHCPv4 DISCOVER with hostname
52 | | [Documentation] | Configure DHCPv4 client on interface to TG with hostname
53 | | ... | and check if DHCPv4 DISCOVER message contains all required
54 | | ... | fields with expected values.
55 | | ...
56 | | Given Configure path in 2-node circular topology
57 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
58 | | And Set interfaces in 2-node circular topology up
59 | | When Set DHCP client on Interface | ${dut_node} | ${dut_to_tg_if1}
60 | | ... | ${client_hostname}
61 | | Then Verify DHCP DISCOVER header | ${tg_node}
62 | | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac} | ${client_hostname}
63
64 | TC03: VPP sends DHCPv4 REQUEST after OFFER
65 | | [Documentation] | Configure DHCPv4 client on interface to TG and check if
66 | | ... | DHCPv4 REQUEST message contains all required fields.
67 | | ...
68 | | Given Configure path in 2-node circular topology
69 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
70 | | And Set interfaces in 2-node circular topology up
71 | | And VPP Route Add | ${dut_node} | 255.255.255.255 | 32 | local=${TRUE}
72 | | When Set DHCP client on Interface | ${dut_node} | ${dut_to_tg_if1}
73 | | Then Verify DHCP REQUEST after OFFER | ${tg_node} | ${tg_to_dut_if1}
74 | | ... | ${tg_to_dut_if1_mac} | ${server_ip}
75 | | ... | ${dut_to_tg_if1_mac} | ${client_ip} | ${client_mask}
76
77 | TC04: VPP doesn't send DHCPv4 REQUEST after OFFER with wrong XID
78 | | [ Tags ] | EXPECTED_FAILING
79 | | [Documentation] | Configure DHCPv4 client on interface to TG. If server
80 | | ... | sends DHCPv4 OFFER with different XID as in DHCPv4
81 | | ... | DISCOVER, DHCPv4 REQUEST message shouldn't be sent.
82 | | ...
83 | | Given Configure path in 2-node circular topology
84 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
85 | | And Set interfaces in 2-node circular topology up
86 | | And VPP Route Add | ${dut_node} | 255.255.255.255 | 32 | local=${TRUE}
87 | | When Set DHCP client on Interface | ${dut_node} | ${dut_to_tg_if1}
88 | | Then Run Keyword And Expect Error | DHCP REQUEST Rx timeout
89 | | ... | Verify DHCP REQUEST after OFFER | ${tg_node} | ${tg_to_dut_if1}
90 | | ... | ${tg_to_dut_if1_mac} | ${server_ip}
91 | | ... | ${dut_to_tg_if1_mac} | ${client_ip} | ${client_mask}
92 | | ... | offer_xid=${own_xid}
93
94 | TC05: VPP honors DHCPv4 lease time
95 | | [Documentation] | Send IP configuration to the VPP client via DHCPv4.
96 | | ... | Address is checked with ICMP echo request and there should
97 | | ... | be no reply for echo request when lease has expired.
98 | | ...
99 | | Given Configure path in 2-node circular topology
100 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
101 | | And Set interfaces in 2-node circular topology up
102 | | And VPP Route Add | ${dut_node} | 255.255.255.255 | 32 | local=${TRUE}
103 | | When Set DHCP client on Interface | ${dut_node} | ${dut_to_tg_if1}
104 | | And Configure IP on client via DHCP
105 | | ... | ${tg_node} | ${tg_to_dut_if1}
106 | | ... | ${tg_to_dut_if1_mac} | ${server_ip}
107 | | ... | ${client_ip} | ${client_mask}
108 | | ... | ${lease_time}
109 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if1} | ${server_ip}
110 | | ... | ${tg_to_dut_if1_mac}
111 | | Then Send ICMP echo request and verify answer
112 | | ... | ${tg_node} | ${tg_to_dut_if1}
113 | | ... | ${dut_to_tg_if1_mac} | ${tg_to_dut_if1_mac} | ${client_ip}
114 | | ... | ${server_ip}
115 | | And Sleep | ${lease_time}
116 | | And Run Keyword And Expect Error | ICMP echo Rx timeout
117 | | ... | Send ICMP echo request and verify answer | ${tg_node}
118 | | ... | ${tg_to_dut_if1} | ${dut_to_tg_if1_mac} | ${tg_to_dut_if1_mac}
119 | | ... | ${client_ip} | ${server_ip}