blob: fbf62b5f785a5538c932fc339274db4c215c988d [file] [log] [blame]
Kailash Khalasic930eac2018-09-05 12:18:23 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15*** Settings ***
16Documentation Library to DHCP Requests from an RG (source host)
17Library OperatingSystem
18Library SSHLibrary
19
20*** Keywords ***
21Send Dhclient Request
22 [Arguments] ${ip} ${user} ${pass} ${iface} ${prompt}=$ ${prompt_timeout}=60s
23 [Documentation] SSH's into the RG (src) and executes a dhclient against a particular interface
24 ${conn_id}= SSHLibrary.Open Connection ${ip} prompt=${prompt} timeout=${prompt_timeout}
25 SSHLibrary.Login ${user} ${pass}
Kailash Khalasi62590372018-09-11 10:24:34 -070026 SSHLibrary.Write sudo dhclient -nw ${iface}
Kailash Khalasic930eac2018-09-05 12:18:23 -070027 Read Until [sudo] password for ${user}:
28 SSHLibrary.Write ${pass}
29 ${result}= Read Until ${prompt}
30 SSHLibrary.Close Connection
31 [Return] ${result}
32
33Add Default Route to Dst Gateway
34 [Arguments] ${ip} ${user} ${pass} ${src_gateway} ${dst_subnet} ${iface} ${prompt}=$ ${prompt_timeout}=60s
35 [Documentation] SSH's into the RG (src) and adds an entry to the routing table
36 ${conn_id}= SSHLibrary.Open Connection ${ip} prompt=${prompt} timeout=${prompt_timeout}
37 SSHLibrary.Login ${user} ${pass}
38 SSHLibrary.Write sudo ip route add ${dst_subnet} via ${src_gateway} dev ${iface}
39 Read Until [sudo] password for ${user}:
40 SSHLibrary.Write ${pass}
41 ${result}= Read Until ${prompt}
42 SSHLibrary.Close Connection
Suchitra Vemurief989602018-09-10 13:45:26 -070043 [Return] ${result}