Browse code

Add Midonet plugin support to devstack.

Add support for Midokura's Midonet plugin to devstack,
in lib/neutron_plugins and lib/neutron_thirdparty.

Change-Id: I9b4d90eab09bbb21b9ba251a311620e0a21e8219

av-mido authored on 2013/07/11 14:59:00
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,82 @@
0
+# Neutron MidoNet plugin
1
+# ----------------------
2
+
3
+# Save trace setting
4
+MY_XTRACE=$(set +o | grep xtrace)
5
+set +o xtrace
6
+
7
+function is_neutron_ovs_base_plugin() {
8
+    # MidoNet does not use l3-agent
9
+    # 0 means True here
10
+    return 1
11
+}
12
+
13
+function neutron_plugin_create_nova_conf() {
14
+    NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"midonet.nova.virt.libvirt.vif.MidonetVifDriver"}
15
+}
16
+
17
+function neutron_plugin_install_agent_packages() {
18
+    :
19
+}
20
+
21
+function neutron_plugin_configure_common() {
22
+    Q_PLUGIN_CONF_PATH=etc/neutron/plugins/midonet
23
+    Q_PLUGIN_CONF_FILENAME=midonet.ini
24
+    Q_DB_NAME="neutron_midonet"
25
+    Q_PLUGIN_CLASS="neutron.plugins.midonet.plugin.MidonetPluginV2"
26
+}
27
+
28
+function neutron_plugin_configure_debug_command() {
29
+    :
30
+}
31
+
32
+function neutron_plugin_configure_dhcp_agent() {
33
+   die $LINENO "q-dhcp must not be executed with MidoNet plugin!"
34
+}
35
+
36
+function neutron_plugin_configure_l3_agent() {
37
+   die $LINENO "q-l3 must not be executed with MidoNet plugin!"
38
+}
39
+
40
+function neutron_plugin_configure_plugin_agent() {
41
+   die $LINENO "q-agt must not be executed with MidoNet plugin!"
42
+}
43
+
44
+function neutron_plugin_configure_service() {
45
+    if [[ "$MIDONET_API_URI" != "" ]]; then
46
+        iniset /$Q_PLUGIN_CONF_FILE MIDONET midonet_uri $MIDONET_API_URI
47
+    fi
48
+    if [[ "$MIDONET_USERNAME" != "" ]]; then
49
+        iniset /$Q_PLUGIN_CONF_FILE MIDONET username $MIDONET_USERNAME
50
+    fi
51
+    if [[ "$MIDONET_PASSWORD" != "" ]]; then
52
+        iniset /$Q_PLUGIN_CONF_FILE MIDONET password $MIDONET_PASSWORD
53
+    fi
54
+    if [[ "$MIDONET_PROJECT_ID" != "" ]]; then
55
+        iniset /$Q_PLUGIN_CONF_FILE MIDONET project_id $MIDONET_PROJECT_ID
56
+    fi
57
+    if [[ "$MIDONET_PROVIDER_ROUTER_ID" != "" ]]; then
58
+        iniset /$Q_PLUGIN_CONF_FILE MIDONET provider_router_id $MIDONET_PROVIDER_ROUTER_ID
59
+    fi
60
+    if [[ "$MIDONET_METADATA_ROUTER_ID" != "" ]]; then
61
+        iniset /$Q_PLUGIN_CONF_FILE MIDONET metadata_router_id $MIDONET_METADATA_ROUTER_ID
62
+    fi
63
+}
64
+
65
+function neutron_plugin_setup_interface_driver() {
66
+    # May change in the future
67
+    :
68
+}
69
+
70
+function has_neutron_plugin_security_group() {
71
+    # 0 means True here
72
+    return 0
73
+}
74
+
75
+function neutron_plugin_check_adv_test_requirements() {
76
+    # 0 means True here
77
+    return 1
78
+}
79
+
80
+# Restore xtrace
81
+$MY_XTRACE
0 82
new file mode 100644
... ...
@@ -0,0 +1,64 @@
0
+# MidoNet
1
+# -------
2
+
3
+# This file implements functions required to configure MidoNet as the third-party
4
+# system used with devstack's Neutron.  To include this file, specify the following
5
+# variables in localrc:
6
+#
7
+# * enable_service midonet
8
+#
9
+
10
+# MidoNet devstack destination dir
11
+MIDONET_DIR=${MIDONET_DIR:-$DEST/midonet}
12
+
13
+# MidoNet client repo
14
+MIDONET_CLIENT_REPO=${MIDONET_CLIENT_REPO:-https://github.com/midokura/python-midonetclient.git}
15
+MIDONET_CLIENT_BRANCH=${MIDONET_CLIENT_BRANCH:-master}
16
+MIDONET_CLIENT_DIR=$MIDONET_DIR/python-midonetclient
17
+
18
+# MidoNet OpenStack repo
19
+MIDONET_OS_REPO=${MIDONET_OS_REPO:-https://github.com/midokura/midonet-openstack.git}
20
+MIDONET_OS_BRANCH=${MIDONET_OS_BRANCH:-master}
21
+MIDONET_OS_DIR=$MIDONET_DIR/midonet-openstack
22
+MIDONET_SETUP_SCRIPT=${MIDONET_SETUP_SCRIPT:-$MIDONET_OS_DIR/bin/setup_midonet_topology.py}
23
+
24
+
25
+MIDOLMAN_LOG=${MIDOLMAN_LOG:-/var/log/midolman/midolman.log}
26
+MIDONET_API_LOG=${MIDONET_API_LOG:-/var/log/tomcat7/midonet-api.log}
27
+
28
+# Save trace setting
29
+MY_XTRACE=$(set +o | grep xtrace)
30
+set +o xtrace
31
+
32
+function configure_midonet() {
33
+    :
34
+}
35
+
36
+function init_midonet() {
37
+
38
+    # Initialize DB.  Evaluate the output of setup_midonet_topology.py to set
39
+    # env variables for provider router ID and metadata router ID
40
+    eval `python $MIDONET_SETUP_SCRIPT admin $ADMIN_PASSWORD $ADMIN_TENANT provider_devices`
41
+    die_if_not_set $LINENO provider_router_id "Error running midonet setup script, provider_router_id was not set."
42
+    die_if_not_set $LINENO metadata_router_id "Error running midonet setup script, metadata_router_id was not set."
43
+
44
+    iniset /$Q_PLUGIN_CONF_FILE MIDONET provider_router_id $provider_router_id
45
+    iniset /$Q_PLUGIN_CONF_FILE MIDONET metadata_router_id $metadata_router_id
46
+}
47
+
48
+function install_midonet() {
49
+    git_clone $MIDONET_CLIENT_REPO $MIDONET_CLIENT_DIR $MIDONET_CLIENT_BRANCH
50
+    git_clone $MIDONET_OS_REPO $MIDONET_OS_DIR $MIDONET_OS_BRANCH
51
+    export PYTHONPATH=$MIDONET_CLIENT_DIR/src:$MIDONET_OS_DIR/src:$PYTHONPATH
52
+}
53
+
54
+function start_midonet() {
55
+    :
56
+}
57
+
58
+function stop_midonet() {
59
+    :
60
+}
61
+
62
+# Restore xtrace
63
+$MY_XTRACE