CSIT-687: Directory structure reorganization
[csit.git] / resources / libraries / robot / features / dhcp_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 | Library  | Collections
16 | Resource | resources/libraries/robot/shared/default.robot
17 | Library  | resources.libraries.python.Dhcp.DhcpProxy
18 | Library  | resources.libraries.python.TrafficScriptExecutor
19 | Documentation | DHCP Proxy specific keywords.
20
21 *** Keywords ***
22 | Send DHCP messages and check answer
23 | | [Documentation] | Send and receive DHCP messages between client
24 | | ...             | and server through DHCP proxy.
25 | | ...
26 | | ... | *Arguments:*
27 | | ... | - tg_node - TG node. Type: dictionary
28 | | ... | - tg_interface1 - TG interface. Type: string
29 | | ... | - tg_interface2 - TG interface. Type: string
30 | | ... | - server_ip - DHCP server IP address. Type: string
31 | | ... | - server_mac - DHCP server MAC address. Type: string
32 | | ... | - client_ip - Client IP address. Type: string
33 | | ... | - client_mac - Client MAC address. Type: string
34 | | ... | - proxy_ip - DHCP proxy IP address. Type: string
35 | | ...
36 | | ... | *Return:*
37 | | ... | - No value returned.
38 | | ...
39 | | ... | *Example:*
40 | | ...
41 | | ... | \| Send DHCP messages and check answer \| ${nodes['TG']} \
42 | | ... | \| eth3 \| eth4 \| 192.168.0.100 \| 08:00:27:cc:4f:54 \
43 | | ... | \| 172.16.0.2 \| 08:00:27:64:18:d2 \| 172.16.0.1 \|
44 | | ...
45 | | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2}
46 | | ... | ${server_ip} | ${server_mac} | ${client_ip} | ${client_mac}
47 | | ... | ${proxy_ip} |
48 | | ${tg_interface_name1}= | Get interface name | ${tg_node} | ${tg_interface1}
49 | | ${tg_interface_name2}= | Get interface name | ${tg_node} | ${tg_interface2}
50 | | ${args}= | Catenate | --tx_if | ${tg_interface_name1}
51 | | ...                 | --rx_if | ${tg_interface_name2}
52 | | ...                 | --server_ip | ${server_ip}
53 | | ...                 | --server_mac | ${server_mac}
54 | | ...                 | --client_ip | ${client_ip}
55 | | ...                 | --client_mac | ${client_mac}
56 | | ...                 | --proxy_ip | ${proxy_ip}
57 | | Run Traffic Script On Node | dhcp/send_and_check_proxy_messages.py
58 | | ... | ${tg_node} | ${args}
59
60 | Send DHCP DISCOVER and check answer
61 | | [Documentation] | Send and receive DHCP DISCOVER.
62 | | ...
63 | | ... | *Arguments:*
64 | | ... | - tg_node - TG node. Type: dictionary
65 | | ... | - tg_interface1 - TG interface. Type: string
66 | | ... | - tg_interface2 - TG interface. Type: string
67 | | ... | - tx_src_ip - Source address of DHCP DISCOVER packet. Type: string
68 | | ... | - tx_dst_ip - Destination address of DHCP DISCOVER packet. Type: string
69 | | ...
70 | | ... | *Return:*
71 | | ... | - No value returned.
72 | | ...
73 | | ... | *Example:*
74 | | ...
75 | | ... | \| Send DHCP DISCOVER and check answer \| ${nodes['TG']} \
76 | | ... | \| eth3 \| eth4 \| 0.0.0.0 \| 255.255.255.255 \|
77 | | ...
78 | | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2}
79 | | ... | ${tx_src_ip} | ${tx_dst_ip} |
80 | | ${tg_interface_name1}= | Get interface name | ${tg_node} | ${tg_interface1}
81 | | ${tg_interface_name2}= | Get interface name | ${tg_node} | ${tg_interface2}
82 | | ${args}= | Catenate | --tx_if | ${tg_interface_name1}
83 | | ...                 | --rx_if | ${tg_interface_name2}
84 | | ...                 | --tx_src_ip | ${tx_src_ip}
85 | | ...                 | --tx_dst_ip | ${tx_dst_ip}
86 | | Run Traffic Script On Node | dhcp/send_and_check_proxy_discover.py
87 | | ... | ${tg_node} | ${args}
88
89 | DHCP DISCOVER should fail
90 | | [Documentation] | Send and receive DHCP DISCOVER should fail.
91 | | ...
92 | | ... | *Arguments:*
93 | | ... | - tg_node - TG node. Type: dictionary
94 | | ... | - tg_interface1 - TG interface. Type: string
95 | | ... | - tg_interface2 - TG interface. Type: string
96 | | ... | - tx_src_ip - Source address of DHCP DISCOVER packet. Type: string
97 | | ... | - tx_dst_ip - Destination address of DHCP DISCOVER packet. Type: string
98 | | ...
99 | | ... | *Return:*
100 | | ... | - No value returned.
101 | | ...
102 | | ... | *Example:*
103 | | ...
104 | | ... | \| DHCP DISCOVER should fail \| ${nodes['TG']} \
105 | | ... | \| eth3 \| eth4 \| 0.0.0.0 \| 255.255.255.1 \|
106 | | ...
107 | | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2}
108 | | ... | ${tx_src_ip} | ${tx_dst_ip} |
109 | | ${tg_interface_name1}= | Get interface name | ${tg_node} | ${tg_interface1}
110 | | ${tg_interface_name2}= | Get interface name | ${tg_node} | ${tg_interface2}
111 | | ${args}= | Catenate | --tx_if | ${tg_interface_name1}
112 | | ...                 | --rx_if | ${tg_interface_name2}
113 | | ...                 | --tx_src_ip | ${tx_src_ip}
114 | | ...                 | --tx_dst_ip | ${tx_dst_ip}
115 | | Run Keyword And Expect Error | DHCP DISCOVER Rx timeout
116 | | ... | Run Traffic Script On Node | dhcp/send_and_check_proxy_discover.py
117 | | ... | ${tg_node} | ${args}
118
119 | Send DHCPv6 Messages
120 | | [Documentation] | Send and receive DHCPv6 messages between client
121 | | ...             | and server through DHCPv6 proxy.
122 | | ...
123 | | ... | *Arguments:*
124 | | ... | - tg_node - TG node. Type: dictionary
125 | | ... | - tg_interface1 - TG interface. Type: string
126 | | ... | - tg_interface2 - TG interface. Type: string
127 | | ... | - proxy_ip - DHCPv6 proxy IP address. Type: string
128 | | ... | - proxy_mac - Proxy MAC address. Type: string
129 | | ... | - server_ip - DHCPv6 server IP address. Type: string
130 | | ... | - server_mac - Server MAC address. Type: string
131 | | ... | - client_mac - Client MAC address. Type: string
132 | | ... | - proxy_to_server_mac - MAC address of proxy interface
133 | | ... |   connected to server. Type: string
134 | | ...
135 | | ... | *Return:*
136 | | ... | - No value returned.
137 | | ...
138 | | ... | *Example:*
139 | | ...
140 | | ... | \| Send DHCPv6 Messages \| ${nodes['TG']} \
141 | | ... | \| eth3 \| eth4 \| 3ffe:62::1 \| 08:00:27:54:59:f9 \
142 | | ... | \| 3ffe:63::2 \| 08:00:27:cc:4f:54 \|
143 | | ... | \| 08:00:27:64:18:d2 \| 08:00:27:c9:6a:d5 \|
144 | | ...
145 | | [Arguments] | ${tg_node} | ${tg_interface1} | ${tg_interface2} | ${proxy_ip}
146 | | ...         | ${proxy_mac} | ${server_ip} | ${server_mac} | ${client_mac}
147 | | ...         | ${proxy_to_server_mac}
148 | | ${tg_interface_name1}= | Get interface name | ${tg_node} | ${tg_interface1}
149 | | ${tg_interface_name2}= | Get interface name | ${tg_node} | ${tg_interface2}
150 | | ${args}= | Catenate | --tx_if | ${tg_interface_name1}
151 | | ...                 | --rx_if | ${tg_interface_name2}
152 | | ...                 | --proxy_ip | ${proxy_ip}
153 | | ...                 | --proxy_mac | ${proxy_mac}
154 | | ...                 | --server_ip | ${server_ip}
155 | | ...                 | --server_mac | ${server_mac}
156 | | ...                 | --client_mac | ${client_mac}
157 | | ...                 | --proxy_to_server_mac | ${proxy_to_server_mac}
158 | | Run Traffic Script On Node | dhcp/send_dhcp_v6_messages.py
159 | | ... | ${tg_node} | ${args}