5 N_CONF=/etc/neutron/neutron.conf
6 OVS_CONF=/etc/neutron/plugins/ml2/openvswitch_agent.ini
10 neutron_core_plugin_class () {
13 NEUTRON_PLUGIN_CLASS=neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2
16 NEUTRON_PLUGIN_CLASS=neutron.plugins.ml2.plugin.Ml2Plugin
19 NEUTRON_PLUGIN_CLASS=neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2
22 NEUTRON_PLUGIN_CLASS=neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2
25 NEUTRON_PLUGIN_CLASS=neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2
28 NEUTRON_PLUGIN_CLASS=neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2
31 NEUTRON_PLUGIN_CLASS=neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin
34 NEUTRON_PLUGIN_CLASS=neutron.plugins.bigswitch.plugin.NeutronRestProxyV2
37 NEUTRON_PLUGIN_CLASS=neutron.plugins.cisco.network_plugin.PluginV2
40 NEUTRON_PLUGIN_CLASS=neutron.plugins.nicira.NeutronPlugin.NvpPluginV2
43 NEUTRON_PLUGIN_CLASS=neutron.plugins.midonet.plugin.MidonetPluginV2
46 NEUTRON_PLUGIN_CLASS=neutron.plugins.nec.nec_plugin.NECPluginV2
49 NEUTRON_PLUGIN_CLASS=neutron.plugins.metaplugin.meta_neutron_plugin.MetaPluginV2
52 NEUTRON_PLUGIN_CLASS=neutron.plugins.mlnx.mlnx_plugin.MellanoxEswitchPlugin
55 NEUTRON_PLUGIN_CLASS=""
60 write_nova_admin_credentials () {
61 db_get neutron/nova_url
62 pkgos_inifile set ${N_CONF} DEFAULT nova_url ${RET}
63 db_get neutron/nova_region
64 pkgos_inifile set ${N_CONF} DEFAULT nova_region_name ${RET}
65 db_get neutron/nova_admin_tenant_id
66 pkgos_inifile set ${N_CONF} DEFAULT nova_admin_tenant_id ${RET}
67 db_get neutron/nova_admin_username
68 pkgos_inifile set ${N_CONF} DEFAULT nova_admin_username ${RET}
69 db_get neutron/nova_admin_password
70 pkgos_inifile set ${N_CONF} DEFAULT nova_admin_password ${RET}
73 if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
74 . /usr/share/debconf/confmodule
76 pkgos_var_user_group neutron
77 chmod 755 /var/lib/neutron
79 pkgos_write_new_conf neutron api-paste.ini
80 pkgos_write_new_conf neutron neutron.conf
81 chmod 0660 /etc/neutron/neutron.conf
83 # Sets the core_plugin directive according to the value in debconf
84 db_get neutron/plugin-select
86 if [ -n "${RET}" ] ; then
87 neutron_core_plugin_class ${NEUTRON_plugin}
88 pkgos_inifile set ${N_CONF} DEFAULT core_plugin ${NEUTRON_PLUGIN_CLASS}
91 # Write the neutron RabbitMQ credentials
92 pkgos_rabbit_write_conf ${N_CONF} oslo_messaging_rabbit neutron
94 # Set the keystone_authtoken directive
95 pkgos_write_admin_creds ${N_CONF} keystone_authtoken neutron
97 # Set the sql_connection directive
98 pkgos_dbc_postinst --suite neutron ${N_CONF} database connection neutron $@
100 db_get neutron/configure_db
101 if [ "$RET" = "true" ] ; then
102 # Migrating to latest release of the db
103 neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade head
106 # Maintain the OVS config
107 if [ ! -e ${OVS_CONF} ] ; then
108 install -D -m 0640 -o neutron -g neutron /usr/share/neutron-common/openvswitch_agent.ini ${OVS_CONF}
111 if [ "${NEUTRON_plugin_path}" = "OpenVSwitch" ] ; then
112 db_get neutron/tenant_network_type
113 pkgos_inifile set ${OVS_CONF} OVS tenant_network_type "${RET}"
115 db_get neutron/enable_tunneling
116 pkgos_inifile set ${OVS_CONF} OVS enable_tunneling "${RET}"
118 db_get neutron/tunnel_id_ranges
119 pkgos_inifile set ${OVS_CONF} OVS tunnel_id_ranges "${RET}"
121 db_get neutron/local_ip
122 pkgos_inifile set ${OVS_CONF} OVS local_ip "${RET}"
125 write_nova_admin_credentials
128 chown -R neutron:adm /var/log/neutron/
129 chmod 0750 /etc/neutron
130 chmod 0750 /var/log/neutron/
131 chown root:root /etc/neutron/rootwrap.conf
132 chown root:root /etc/neutron/rootwrap.d
133 chmod 0755 /etc/neutron/rootwrap.d
135 # The /var/lib/neutron/dhcp needs to be readable from the nobody user.
136 chmod 755 /var/lib/neutron
137 mkdir -p /var/lib/neutron/dhcp
138 chown neutron:neutron /var/lib/neutron/dhcp
139 chmod 755 /var/lib/neutron/dhcp
141 if [ -f /etc/sudoers.d/neutron_sudoers ] ; then
142 chmod 0440 /etc/sudoers.d/neutron_sudoers