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

package info (click to toggle)
neutron-dynamic-routing 2:15.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,168 kB
  • sloc: python: 7,878; sh: 268; makefile: 41
file content (31 lines) | stat: -rw-r--r-- 1,113 bytes parent folder | download
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
#!/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}$'`
                        if [ -n "${DEFROUTE_IP}" ] ; then
                                db_set neutron-dynamic-routing/router-id ${DEFROUTE_IP}
                        fi
                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