Show neutron router namespaces by floating IP (FIP)

FLOATING_IP=1.2.3.4
 
# search in floating IP table
ROUTER_ID=$(openstack floating ip list --floating-ip-address ${FLOATING_IP} --long -c Router -f value)
if [ -z ${ROUTER_ID} ]; then
    # search in router
    ROUTER_ID=$(openstack router list --long | grep ${FLOATING_IP} | cut -d" " -f2)
fi
 
PROJECT_ID=$(openstack router show ${ROUTER_ID} -c project_id -f value)
 
echo -e "\e[34m# Project"
openstack router show ${ROUTER_ID} -c id -c name 
 
echo
echo -e "\e[34m# Router"
openstack project show ${PROJECT_ID} -c id -c name -c description
 
echo
echo -e "\e[34m# Router namespaces"
openstack network agent list --router ${ROUTER_ID} --long --sort-column 'HA State'
echo
 
ROUTER_HOSTS=$(openstack network agent list --router ${ROUTER_ID} --long --sort-column 'HA State' -c Host -f value)
for ROUTER_HOST in ${ROUTER_HOSTS}; do
    echo -e "\e[1m\e[32mssh -t ${ROUTER_HOST} sudo ip netns exec qrouter-${ROUTER_ID} bash"
    ssh ${ROUTER_HOST} sudo ip netns exec qrouter-${ROUTER_ID} ip a | sed -n '/BROADCAST/,$p' | egrep -v "inet6|valid_lft"
    echo
done
 
SERVER_FIXED_IP=$(openstack floating ip list --floating-ip-address ${FLOATING_IP} -c "Fixed IP Address" -f value 2>/dev/null)
if [ ! -z ${SERVER_FIXED_IP} ]; then
    echo -e "\e[34m# Server"
    openstack server list --all-projects --ip ${SERVER_FIXED_IP}
fi