5 . /usr/share/debconf/confmodule
7 N_CONF=/etc/neutron/neutron.conf
8 OVS_CONF=/etc/neutron/plugins/ml2/openvswitch_agent.ini
10 # Please remember this function is also in debian/plugin_guess_func
11 neutron_core_plugin_to_plugin_name () {
13 "neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2")
14 NEUTRON_PLUGIN_NAME=OpenVSwitch
16 "neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2")
17 NEUTRON_PLUGIN_NAME=LinuxBridge
19 "neutron.plugins.ml2.plugin.Ml2Plugin")
20 NEUTRON_PLUGIN_NAME=ml2
22 "neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2")
23 NEUTRON_PLUGIN_NAME=RYU
25 "neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2")
26 NEUTRON_PLUGIN_NAME=PLUMgrid
28 "neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2")
29 NEUTRON_PLUGIN_NAME=Brocade
31 "neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin")
32 NEUTRON_PLUGIN_NAME=Hyper-V
34 "neutron.plugins.bigswitch.plugin.NeutronRestProxyV2")
35 NEUTRON_PLUGIN_NAME=BigSwitch
37 "neutron.plugins.cisco.network_plugin.PluginV2")
38 NEUTRON_PLUGIN_NAME=Cisco
40 "neutron.plugins.nicira.NeutronPlugin.NvpPluginV2")
41 NEUTRON_PLUGIN_NAME=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2
43 "neutron.plugins.midonet.plugin.MidonetPluginV2")
44 NEUTRON_PLUGIN_NAME=Midonet
46 "neutron.plugins.nec.nec_plugin.NECPluginV2")
47 NEUTRON_PLUGIN_NAME=Nec
49 "neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2")
50 NEUTRON_PLUGIN_NAME=MetaPlugin
52 "neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin")
53 NEUTRON_PLUGIN_NAME=Mellanox
55 "vmware_nsx.plugin.NsxVPlugin")
56 NEUTRON_PLUGIN_NAME=VMware
59 NEUTRON_PLUGIN_NAME="other"
66 pkgos_var_user_group neutron
67 chmod 755 /var/lib/neutron
69 # Configure the SQL connection
70 pkgos_dbc_read_conf -pkg neutron-common ${N_CONF} database connection neutron $@
71 pkgos_rabbit_read_conf ${N_CONF} oslo_messaging_rabbit neutron
73 # Configure the keystone_authtoken
74 pkgos_read_admin_creds ${N_CONF} keystone_authtoken neutron
76 # Select which plugin to use
77 if [ -r "${N_CONF}" ] ; then
78 pkgos_inifile get ${N_CONF} DEFAULT core_plugin
79 if [ -n "${RET}" ] ; then
80 NEUTRON_CORE_PLUGIN_CLASS=${RET}
81 neutron_core_plugin_to_plugin_name ${NEUTRON_CORE_PLUGIN_CLASS}
82 db_set neutron/plugin-select ${NEUTRON_PLUGIN_NAME}
85 db_input high neutron/plugin-select || true
87 db_get neutron/plugin-select
88 NEUTRON_PLUGIN_NAME=${RET}
90 read_nova_admin_credentials () {
91 pkgos_read_config -p high ${N_CONF} nova url neutron/nova_url
92 pkgos_read_config -p high ${N_CONF} nova region_name neutron/nova_region
93 pkgos_read_config -p medium ${N_CONF} nova project_name neutron/nova_admin_tenant_name
94 pkgos_read_config -p medium ${N_CONF} nova username neutron/nova_admin_username
95 pkgos_read_config -p high ${N_CONF} nova password neutron/nova_admin_password
98 # OVS specific configurations (if that's the one selected)
99 if [ "${NEUTRON_PLUGIN_NAME}" = "OpenVSwitch" ] ; then
100 # Various network config...
101 pkgos_read_config ${OVS_CONF} OVS tenant_network_type neutron/tenant_network_type
102 pkgos_read_config ${OVS_CONF} OVS enable_tunneling neutron/enable_tunneling
103 pkgos_read_config ${OVS_CONF} OVS tunnel_id_ranges neutron/tunnel_id_ranges
105 read_nova_admin_credentials
107 # Guess values to put in the local_ip directive
108 IF=`LC_ALL=C route | grep default |awk -- '{ print $8 }'`
109 guessed_ip_addr=`LC_ALL=C ifconfig ${IF} | grep 'inet addr' | sed 's/.\+inet addr:\([0-9.]\+\).\+/\1/'`
110 if [ -z "${guessed_ip_addr}" ] ; then
111 guessed_ip_addr=`LC_ALL=C ifconfig ${IF} | grep 'inet adr' | sed 's/.\+inet adr:\([0-9.]\+\).\+/\1/'`
113 db_set neutron/local_ip ${guessed_ip_addr}
114 pkgos_read_config ${OVS_CONF} OVS local_ip neutron/local_ip