blob: e988b2a37d036913138ec190e469c9e59462e6fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
source config.sh
source odl_utils.sh
source topologies/2_node_topo.sh
if [ "$1" == "clean" ] ; then
2_node_topo_clean no_odl
exit 0
fi
if [[ $(id -u) != 0 ]]; then
echo "Error: run this as root."
exit 1
fi
function start_dhcp_server
{
echo "starting DHCP server from namespace $1"
ip netns exec "$1" python scripts/dhcp_server.py &
dhcp_id=$!
}
function send_dhcp_discovery
{
src_mac="`sudo ip netns exec vppns1 ifconfig veth_vpp1 | grep HWaddr | awk '{print $5}'`"
ip netns exec "$1" python scripts/dhcp_client.py "$src_mac" "$2"
rc=$?
}
function test_dhcp
{
2_node_topo_setup no_odl
test_result=1
# dhcp proxy1 config
echo "set dhcp proxy server 6.0.2.2 src-address 6.0.1.1" | nc 0 5002
maybe_pause
# run DHCP server from namespace
start_dhcp_server vppns2
# send DHCP discovery from namespace and check if reply (= DHCP offer)
# comes from the proxy DHCP address
send_dhcp_discovery vppns1 "6.0.1.1"
maybe_pause
2_node_topo_clean no_odl
kill $dhcp_id
print_status $rc "DHCP test failed!"
exit $test_result
}
|