This provides the support for the monolithic plugin
for IBM SDN-VE that is being added to Neutron here:
https://review.openstack.org/#/c/66453/
Implements: blueprint ibm-sdnve-plugin-support
Depends-On: I92619a95bca2ae0c37e7fdd39da30119b43d1ad6
DocImpact
Change-Id: I0958457355036fdab93156cd7fb4afd1a458918b
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,133 @@ |
| 0 |
+# Neutron IBM SDN-VE plugin |
|
| 1 |
+# --------------------------- |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+source $TOP_DIR/lib/neutron_plugins/ovs_base |
|
| 8 |
+ |
|
| 9 |
+function neutron_plugin_install_agent_packages {
|
|
| 10 |
+ _neutron_ovs_base_install_agent_packages |
|
| 11 |
+} |
|
| 12 |
+ |
|
| 13 |
+function _neutron_interface_setup {
|
|
| 14 |
+ # Setup one interface on the integration bridge if needed |
|
| 15 |
+ # The plugin agent to be used if more than one interface is used |
|
| 16 |
+ local bridge=$1 |
|
| 17 |
+ local interface=$2 |
|
| 18 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-port $bridge $interface |
|
| 19 |
+} |
|
| 20 |
+ |
|
| 21 |
+function neutron_setup_integration_bridge {
|
|
| 22 |
+ # Setup integration bridge if needed |
|
| 23 |
+ if [[ "$SDNVE_INTEGRATION_BRIDGE" != "" ]]; then |
|
| 24 |
+ neutron_ovs_base_cleanup |
|
| 25 |
+ _neutron_ovs_base_setup_bridge $SDNVE_INTEGRATION_BRIDGE |
|
| 26 |
+ if [[ "$SDNVE_INTERFACE_MAPPINGS" != "" ]]; then |
|
| 27 |
+ interfaces=(${SDNVE_INTERFACE_MAPPINGS//[,:]/ })
|
|
| 28 |
+ _neutron_interface_setup $SDNVE_INTEGRATION_BRIDGE ${interfaces[1]}
|
|
| 29 |
+ fi |
|
| 30 |
+ fi |
|
| 31 |
+ |
|
| 32 |
+ # Set controller to SDNVE controller (1st of list) if exists |
|
| 33 |
+ if [[ "$SDNVE_CONTROLLER_IPS" != "" ]]; then |
|
| 34 |
+ # Get the first controller |
|
| 35 |
+ controllers=(${SDNVE_CONTROLLER_IPS//[\[,\]]/ })
|
|
| 36 |
+ SDNVE_IP=${controllers[0]}
|
|
| 37 |
+ sudo ovs-vsctl set-controller $SDNVE_INTEGRATION_BRIDGE tcp:$SDNVE_IP |
|
| 38 |
+ fi |
|
| 39 |
+} |
|
| 40 |
+ |
|
| 41 |
+function neutron_plugin_create_nova_conf {
|
|
| 42 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"}
|
|
| 43 |
+ # if n-cpu is enabled, then setup integration bridge |
|
| 44 |
+ if is_service_enabled n-cpu; then |
|
| 45 |
+ neutron_setup_integration_bridge |
|
| 46 |
+ fi |
|
| 47 |
+} |
|
| 48 |
+ |
|
| 49 |
+function is_neutron_ovs_base_plugin {
|
|
| 50 |
+ if [[ "$SDNVE_INTEGRATION_BRIDGE" != "" ]]; then |
|
| 51 |
+ # Yes, we use OVS. |
|
| 52 |
+ return 0 |
|
| 53 |
+ else |
|
| 54 |
+ # No, we do not use OVS. |
|
| 55 |
+ return 1 |
|
| 56 |
+ fi |
|
| 57 |
+} |
|
| 58 |
+ |
|
| 59 |
+function neutron_plugin_configure_common {
|
|
| 60 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ibm |
|
| 61 |
+ Q_PLUGIN_CONF_FILENAME=sdnve_neutron_plugin.ini |
|
| 62 |
+ Q_DB_NAME="sdnve_neutron" |
|
| 63 |
+ Q_PLUGIN_CLASS="neutron.plugins.ibm.sdnve_neutron_plugin.SdnvePluginV2" |
|
| 64 |
+} |
|
| 65 |
+ |
|
| 66 |
+function neutron_plugin_configure_service {
|
|
| 67 |
+ # Define extra "SDNVE" configuration options when q-svc is configured |
|
| 68 |
+ |
|
| 69 |
+ iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver |
|
| 70 |
+ |
|
| 71 |
+ if [[ "$SDNVE_CONTROLLER_IPS" != "" ]]; then |
|
| 72 |
+ iniset /$Q_PLUGIN_CONF_FILE sdnve controller_ips $SDNVE_CONTROLLER_IPS |
|
| 73 |
+ fi |
|
| 74 |
+ |
|
| 75 |
+ if [[ "$SDNVE_INTEGRATION_BRIDGE" != "" ]]; then |
|
| 76 |
+ iniset /$Q_PLUGIN_CONF_FILE sdnve integration_bridge $SDNVE_INTEGRATION_BRIDGE |
|
| 77 |
+ fi |
|
| 78 |
+ |
|
| 79 |
+ if [[ "$SDNVE_RESET_BRIDGE" != "" ]]; then |
|
| 80 |
+ iniset /$Q_PLUGIN_CONF_FILE sdnve reset_bridge $SDNVE_RESET_BRIDGE |
|
| 81 |
+ fi |
|
| 82 |
+ |
|
| 83 |
+ if [[ "$SDNVE_OUT_OF_BAND" != "" ]]; then |
|
| 84 |
+ iniset /$Q_PLUGIN_CONF_FILE sdnve out_of_band $SDNVE_OUT_OF_BAND |
|
| 85 |
+ fi |
|
| 86 |
+ |
|
| 87 |
+ if [[ "$SDNVE_INTERFACE_MAPPINGS" != "" ]]; then |
|
| 88 |
+ iniset /$Q_PLUGIN_CONF_FILE sdnve interface_mappings $SDNVE_INTERFACE_MAPPINGS |
|
| 89 |
+ fi |
|
| 90 |
+ |
|
| 91 |
+ if [[ "$SDNVE_FAKE_CONTROLLER" != "" ]]; then |
|
| 92 |
+ iniset /$Q_PLUGIN_CONF_FILE sdnve use_fake_controller $SDNVE_FAKE_CONTROLLER |
|
| 93 |
+ fi |
|
| 94 |
+ |
|
| 95 |
+ |
|
| 96 |
+ iniset $NEUTRON_CONF DEFAULT notification_driver neutron.openstack.common.notifier.no_op_notifier |
|
| 97 |
+ |
|
| 98 |
+} |
|
| 99 |
+ |
|
| 100 |
+function neutron_plugin_configure_plugin_agent {
|
|
| 101 |
+ AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-ibm-agent" |
|
| 102 |
+} |
|
| 103 |
+ |
|
| 104 |
+function neutron_plugin_configure_debug_command {
|
|
| 105 |
+ : |
|
| 106 |
+} |
|
| 107 |
+ |
|
| 108 |
+function neutron_plugin_setup_interface_driver {
|
|
| 109 |
+ return 0 |
|
| 110 |
+} |
|
| 111 |
+ |
|
| 112 |
+function has_neutron_plugin_security_group {
|
|
| 113 |
+ # Does not support Security Groups |
|
| 114 |
+ return 1 |
|
| 115 |
+} |
|
| 116 |
+ |
|
| 117 |
+function neutron_ovs_base_cleanup {
|
|
| 118 |
+ if [[ "$SDNVE_RESET_BRIDGE" != False ]]; then |
|
| 119 |
+ # remove all OVS ports that look like Neutron created ports |
|
| 120 |
+ for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do |
|
| 121 |
+ sudo ovs-vsctl del-port ${port}
|
|
| 122 |
+ done |
|
| 123 |
+ |
|
| 124 |
+ # remove integration bridge created by Neutron |
|
| 125 |
+ for bridge in $(sudo ovs-vsctl list-br | grep -o -e ${SDNVE_INTEGRATION_BRIDGE}); do
|
|
| 126 |
+ sudo ovs-vsctl del-br ${bridge}
|
|
| 127 |
+ done |
|
| 128 |
+ fi |
|
| 129 |
+} |
|
| 130 |
+ |
|
| 131 |
+# Restore xtrace |
|
| 132 |
+$MY_XTRACE |