3 source topologies/2_node_topo.sh
5 if [ "$1" == "clean" ] ; then
6 2_node_topo_clean no_odl
10 if [[ $(id -u) != 0 ]]; then
11 echo "Error: run this as root."
15 function start_dhcp_server
17 echo "starting DHCP server from namespace $1"
18 ip netns exec "$1" python scripts/dhcp_server.py &
22 function send_dhcp_discovery
24 src_mac="`sudo ip netns exec vppns1 ifconfig veth_vpp1 | grep HWaddr | awk '{print $5}'`"
25 ip netns exec "$1" python scripts/dhcp_client.py "$src_mac" "$2"
31 2_node_topo_setup no_odl
35 echo "set dhcp proxy server 6.0.2.2 src-address 6.0.1.1" | nc 0 5002
39 # run DHCP server from namespace
40 start_dhcp_server vppns2
42 # send DHCP discovery from namespace and check if reply (= DHCP offer)
43 # comes from the proxy DHCP address
44 send_dhcp_discovery vppns1 "6.0.1.1"
47 2_node_topo_clean no_odl
50 print_status $rc "DHCP test failed!"