#!/bin/bash

# exec command: ovs-ofctl dump-flows br0 -Oopenflow13 | grep -wc cookie=0x60006

# ovs command existence
which ovs-ofctl > /dev/null
if [[ $? -ne 0 ]];then
        exit 0
fi

# br0 existence
if [[ $(ovs-vsctl list-br|grep -cE "^br0$") -eq 0 ]];then
        exit 0
fi

count=$(ovs-ofctl dump-flows br0 -Oopenflow13 | grep -wc cookie=0x60006 2>/dev/null)

echo "[{\"value\":$count,\"tags\":\"\"}]"
