blob: 8fa37e8935f6203ca14c9d643dd22cf6b2af8ed1 [file] [log] [blame]
David K. Bainbridge317e7d72016-05-11 08:31:44 -07001#!/bin/bash
2
3BG=0
4
5while [ $# -gt 0 ]; do
6 case $1 in
7 -bg|-background)
8 BG=1
9 esac
10 shift
11done
12
David K. Bainbridgef4181702016-06-17 14:44:03 -070013IP=$(ping -c 1 {{ controller_ip }} 2>/dev/null | grep PING | awk '{print $3}' | sed -e 's/[\(\)]//g')
14while [ "$IP x" == " x" ]; do
15 echo "Waiting for controller to resolve ({{ controller_ip }}) ... sleeping 5s and will try again ..."
16 sleep 5
17 IP=$(ping -c 1 {{ controller_ip }} 2>/dev/null | grep PING | awk '{print $3}' | sed -e 's/[\(\)]//g')
18done
19
David K. Bainbridge317e7d72016-05-11 08:31:44 -070020if [ $BG -eq 1 ]; then
David K. Bainbridgef4181702016-06-17 14:44:03 -070021 nohup brcm-indigo-ofdpa-ofagent --dpid={{ switch_id }} --controller=$IP 2>&1 > connect.log &
David K. Bainbridge317e7d72016-05-11 08:31:44 -070022else
David K. Bainbridgef4181702016-06-17 14:44:03 -070023 brcm-indigo-ofdpa-ofagent --dpid={{ switch_id }} --controller=$IP
David K. Bainbridge317e7d72016-05-11 08:31:44 -070024fi