File: neutron-dynamic-routing-common.config.in

package info (click to toggle)
neutron-dynamic-routing 2%3A21.0.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,172 kB
  • sloc: python: 6,397; sh: 152; makefile: 41
file content (37 lines) | stat: -rw-r--r-- 1,327 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

set -e

. /usr/share/debconf/confmodule

BGP_AGENT_CONF="/etc/neutron/bgp_dragent.ini"

#PKGOS-INCLUDE#

manage_router_id() {
        pkgos_inifile get ${BGP_AGENT_CONF} bgp bgp_router_id
        if [ -n "${RET}" ] && [ ! "${RET}" = "NOT_FOUND" ] ; then
                db_set neutron-dynamic-routing/router-id "${RET}"
        else
                DEFROUTE_IF=`awk '{ if ( $2 == "00000000" ) print $1 }' /proc/net/route | head -n 1`
                if [ -n "${DEFROUTE_IF}" ] ; then
                        DEFROUTE_IP=$(LC_ALL=C ip addr show "${DEFROUTE_IF}" | grep inet | head -n 1 | awk '{print $2}' | cut -d/ -f1 | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' || true)
                fi
                if [ -z "${DEFROUTE_IP}" ] ; then
                	HOSTNAME_IP=$(hostname -i)
                	if [ -n "${HOSTNAME_IP}" ] ; then
                		DEFROUTE_IP=${HOSTNAME_IP}
                	fi
                fi
                if [ -n "${DEFROUTE_IP}" ] ; then
                        db_set neutron-dynamic-routing/router-id ${DEFROUTE_IP}
                fi
        fi
        db_input high neutron-dynamic-routing/router-id || true
        db_go
}

# Ask user if he wants db migration
db_input high neutron-dynamic-routing/configure-dynamic-routing || true
manage_router_id
db_go || true