115646d42e0015a73b01c0a3af8426835482f81a
[csit.git] / resources / libraries / robot / dhcp_client.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  | Collections
16 | Resource | resources/libraries/robot/default.robot
17 | Library  | resources.libraries.python.Dhcp.DhcpClient
18 | Library  | resources.libraries.python.TrafficScriptExecutor
19 | Documentation | DHCP Client specific keywords.
20
21 *** Keywords ***
22 | Check DHCP DISCOVER header
23 | | [Documentation] | Check if DHCP message contains all required fields.
24 | | ...
25 | | ... | *Arguments:*
26 | | ... | - tg_node - TG node. Type: dictionary
27 | | ... | - interface - TGs interface where listen for DHCP DISCOVER message.
28 | | ... |   Type: string
29 | | ... | - src_mac - DHCP clients MAC address. Type: string
30 | | ... | - hostname - DHCP clients hostname (Optional, Default="", if not
31 | | ... |   specified, the hostneme is not configured). Type: string
32 | | ...
33 | | ... | *Return:*
34 | | ... | - No value returned
35 | | ...
36 | | ... | *Example:*
37 | | ...
38 | | ... | \| Check DHCP DISCOVER header \| ${nodes['TG']} \
39 | | ... | \| eth2 \| 08:00:27:66:b8:57 \|
40 | | ... | \| Check DHCP DISCOVER header \| ${nodes['TG']} \
41 | | ... | \| eth2 \| 08:00:27:66:b8:57 \| client-hostname \|
42 | | ...
43 | | [Arguments] | ${tg_node} | ${interface} | ${src_mac} | ${hostname}=${EMPTY}
44 | | ${args}= | Run Keyword If | "${hostname}" == "" | Catenate
45 | |          | ...  | --rx_if | ${interface} | --rx_src_mac | ${src_mac}
46 | | ...      | ELSE | Catenate | --rx_if | ${interface} | --rx_src_mac
47 | |          | ...  | ${src_mac} | --hostname | ${hostname}
48 | | Run Traffic Script On Node | dhcp/check_dhcp_discover.py
49 | | ... | ${tg_node} | ${args}