#!/bin/sh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

case $0 in
    */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'`
         ovsdir=`echo "$dir0" | sed 's,/ovn/scripts,,'`
         ovsdir=$ovsdir/openvswitch/scripts
         ;;
    *) dir0=./ ;;
esac
. "$ovsdir/ovs-lib" || exit 1
. "$dir0/ovn-lib" || exit 1

for dir in "$sbindir" "$ovn_bindir" "$bindir" /sbin /bin /usr/sbin /usr/bin; do
    case :$PATH: in
        *:$dir:*) ;;
        *) PATH=$PATH:$dir ;;
    esac
done


ovnnb_active_conf_file="$ovn_etcdir/ovnnb-active.conf"
ovnsb_active_conf_file="$ovn_etcdir/ovnsb-active.conf"
ovn_northd_db_conf_file="$ovn_etcdir/ovn-northd-db-params.conf"
ic_nb_active_conf_file="$ovn_etcdir/ic-nb-active.conf"
ic_sb_active_conf_file="$ovn_etcdir/ic-sb-active.conf"
ovn_ic_db_conf_file="$ovn_etcdir/ovn-ic-db-params.conf"

OVS_RUNDIR=${OVS_RUNDIR} stop_ovn_daemon ovn-controller "" "" --restart
