#!/bin/bash

ifaces=$(ovs-vsctl show | grep -oP "could not open network device\s*\Kveth[a-f0-9]+")
[ $? -eq 0 ] || exit

#Find bridge
#ovs-vsctl list-br

for iface in $ifaces; do
#    echo "$iface"

# Verify that interface is not active
    ip link show | grep $iface &> /dev/null
    [ $? -eq 0 ] && continue

    echo "Removing: $iface"
    ovs-vsctl del-port br0 $iface
done
