#!/bin/bash

set -x

# Reset OpenFlow protocol version before ovn-controller takes over
ovs-vsctl set Bridge {{ integration_bridge }} protocols=[]
ovs-vsctl set Bridge {{ external_bridge }} protocols=[]

# Delete controller from integration bridge
ovs-vsctl del-controller {{ integration_bridge }}

# Activate ovn-controller by configuring integration bridge
ovs-vsctl set open . external_ids:ovn-bridge={{ integration_bridge }}

docker start ovn_controller

# Delete ovs bridges - br-tun and br-migration
ovs-vsctl --if-exists del-br {{ tunnel_bridge }}
ovs-vsctl --if-exists del-br br-migration

exit 0
