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} nova url ${RET}
64 db_get neutron/nova_region
65 pkgos_inifile set ${N_CONF} nova region_name ${RET}
67 db_get neutron/nova_admin_tenant_name
68 NOVA_TENANT_NAME_IN_NEUTRON=${RET}
69 pkgos_inifile set ${N_CONF} nova tenant_name ${RET}
70 pkgos_inifile set ${N_CONF} nova project_name ${RET}
72 db_get neutron/nova_admin_username
73 pkgos_inifile set ${N_CONF} nova username ${RET}
75 db_get neutron/nova_admin_password
76 pkgos_inifile set ${N_CONF} nova password ${RET}
79 if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
80 . /usr/share/debconf/confmodule
82 pkgos_var_user_group neutron
83 chmod 755 /var/lib/neutron
85 pkgos_write_new_conf neutron api-paste.ini
86 pkgos_write_new_conf neutron neutron.conf
87 chmod 0660 /etc/neutron/neutron.conf
89 # Sets the core_plugin directive according to the value in debconf
90 db_get neutron/plugin-select
92 if [ -n "${RET}" ] ; then
93 neutron_core_plugin_class ${NEUTRON_plugin}
94 pkgos_inifile set ${N_CONF} DEFAULT core_plugin ${NEUTRON_PLUGIN_CLASS}
97 # Write the neutron RabbitMQ credentials
98 pkgos_rabbit_write_conf ${N_CONF} oslo_messaging_rabbit neutron
100 # Set the keystone_authtoken directive
101 pkgos_write_admin_creds ${N_CONF} keystone_authtoken neutron
103 # Set the sql_connection directive
104 pkgos_dbc_postinst --suite neutron ${N_CONF} database connection neutron $@
106 db_get neutron/configure_db
107 if [ "$RET" = "true" ] ; then
108 # Migrating to latest release of the db
109 neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade head
112 # Maintain the OVS config
113 if [ ! -e ${OVS_CONF} ] ; then
114 install -D -m 0640 -o neutron -g neutron /usr/share/neutron-common/openvswitch_agent.ini ${OVS_CONF}
117 if [ "${NEUTRON_plugin_path}" = "OpenVSwitch" ] ; then
118 db_get neutron/tenant_network_type
119 pkgos_inifile set ${OVS_CONF} OVS tenant_network_type "${RET}"
121 db_get neutron/enable_tunneling
122 pkgos_inifile set ${OVS_CONF} OVS enable_tunneling "${RET}"
124 db_get neutron/tunnel_id_ranges
125 pkgos_inifile set ${OVS_CONF} OVS tunnel_id_ranges "${RET}"
127 db_get neutron/local_ip
128 pkgos_inifile set ${OVS_CONF} OVS local_ip "${RET}"
131 write_nova_admin_credentials
134 chown -R neutron:adm /var/log/neutron/
135 chmod 0700 /etc/neutron
136 chmod 0750 /var/log/neutron/
137 chown root:root /etc/neutron/rootwrap.conf
138 chown root:root /etc/neutron/rootwrap.d
139 chmod 0755 /etc/neutron/rootwrap.d
141 # The /var/lib/neutron/dhcp needs to be readable from the nobody user.
142 chmod 755 /var/lib/neutron
143 mkdir -p /var/lib/neutron/dhcp
144 chown neutron:neutron /var/lib/neutron/dhcp
145 chmod 755 /var/lib/neutron/dhcp
147 if [ -f /etc/sudoers.d/neutron_sudoers ] ; then
148 chmod 0440 /etc/sudoers.d/neutron_sudoers