Note: Nova and Horizon are not updated until those projects have
migrated.
Change-Id: I256ef20e7caadd9c96e6dd908c5d8b69ca5c4aeb
... | ... |
@@ -110,7 +110,7 @@ follows: |
110 | 110 |
* Global service configuration like ``ENABLED_SERVICES`` |
111 | 111 |
* Variables used by multiple services that do not have a clear owner, i.e. |
112 | 112 |
``VOLUME_BACKING_FILE_SIZE`` (nova-volumes and cinder) or ``PUBLIC_NETWORK_NAME`` |
113 |
- (nova-network and quantum) |
|
113 |
+ (nova-network and neutron) |
|
114 | 114 |
* Variables that can not be cleanly declared in a project file due to |
115 | 115 |
dependency ordering, i.e. the order of sourcing the project files can |
116 | 116 |
not be changed for other reasons but the earlier file needs to dereference a |
... | ... |
@@ -104,11 +104,11 @@ If you are enabling `swift3` in `ENABLED_SERVICES` devstack will install the swi |
104 | 104 |
|
105 | 105 |
Only Swift proxy server is launched in the screen session all other services are started in background and managed by `swift-init` tool. |
106 | 106 |
|
107 |
-# Quantum |
|
107 |
+# Neutron |
|
108 | 108 |
|
109 | 109 |
Basic Setup |
110 | 110 |
|
111 |
-In order to enable Quantum a single node setup, you'll need the following settings in your `localrc` : |
|
111 |
+In order to enable Neutron a single node setup, you'll need the following settings in your `localrc` : |
|
112 | 112 |
|
113 | 113 |
disable_service n-net |
114 | 114 |
enable_service q-svc |
... | ... |
@@ -116,13 +116,13 @@ In order to enable Quantum a single node setup, you'll need the following settin |
116 | 116 |
enable_service q-dhcp |
117 | 117 |
enable_service q-l3 |
118 | 118 |
enable_service q-meta |
119 |
- enable_service quantum |
|
119 |
+ enable_service neutron |
|
120 | 120 |
# Optional, to enable tempest configuration as part of devstack |
121 | 121 |
enable_service tempest |
122 | 122 |
|
123 | 123 |
Then run `stack.sh` as normal. |
124 | 124 |
|
125 |
-devstack supports adding specific Quantum configuration flags to both the Open vSwitch and LinuxBridge plugin configuration files. To make use of this feature, the following variables are defined and can be configured in your `localrc` file: |
|
125 |
+devstack supports adding specific Neutron configuration flags to both the Open vSwitch and LinuxBridge plugin configuration files. To make use of this feature, the following variables are defined and can be configured in your `localrc` file: |
|
126 | 126 |
|
127 | 127 |
Variable Name Plugin Config File Section Modified |
128 | 128 |
------------------------------------------------------------------------------------- |
... | ... |
@@ -144,7 +144,7 @@ If tempest has been successfully configured, a basic set of smoke tests can be r |
144 | 144 |
|
145 | 145 |
# Multi-Node Setup |
146 | 146 |
|
147 |
-A more interesting setup involves running multiple compute nodes, with Quantum networks connecting VMs on different compute nodes. |
|
147 |
+A more interesting setup involves running multiple compute nodes, with Neutron networks connecting VMs on different compute nodes. |
|
148 | 148 |
You should run at least one "controller node", which should have a `stackrc` that includes at least: |
149 | 149 |
|
150 | 150 |
disable_service n-net |
... | ... |
@@ -153,7 +153,7 @@ You should run at least one "controller node", which should have a `stackrc` tha |
153 | 153 |
enable_service q-dhcp |
154 | 154 |
enable_service q-l3 |
155 | 155 |
enable_service q-meta |
156 |
- enable_service quantum |
|
156 |
+ enable_service neutron |
|
157 | 157 |
|
158 | 158 |
You likely want to change your `localrc` to run a scheduler that will balance VMs across hosts: |
159 | 159 |
|
... | ... |
@@ -161,7 +161,7 @@ You likely want to change your `localrc` to run a scheduler that will balance VM |
161 | 161 |
|
162 | 162 |
You can then run many compute nodes, each of which should have a `stackrc` which includes the following, with the IP address of the above controller node: |
163 | 163 |
|
164 |
- ENABLED_SERVICES=n-cpu,rabbit,g-api,quantum,q-agt |
|
164 |
+ ENABLED_SERVICES=n-cpu,rabbit,g-api,neutron,q-agt |
|
165 | 165 |
SERVICE_HOST=[IP of controller node] |
166 | 166 |
MYSQL_HOST=$SERVICE_HOST |
167 | 167 |
RABBIT_HOST=$SERVICE_HOST |
... | ... |
@@ -42,7 +42,7 @@ source $TOP_DIR/lib/cinder |
42 | 42 |
source $TOP_DIR/lib/swift |
43 | 43 |
source $TOP_DIR/lib/ceilometer |
44 | 44 |
source $TOP_DIR/lib/heat |
45 |
-source $TOP_DIR/lib/quantum |
|
45 |
+source $TOP_DIR/lib/neutron |
|
46 | 46 |
source $TOP_DIR/lib/baremetal |
47 | 47 |
source $TOP_DIR/lib/ldap |
48 | 48 |
|
... | ... |
@@ -60,7 +60,7 @@ cleanup_cinder |
60 | 60 |
cleanup_glance |
61 | 61 |
cleanup_keystone |
62 | 62 |
cleanup_nova |
63 |
-cleanup_quantum |
|
63 |
+cleanup_neutron |
|
64 | 64 |
cleanup_swift |
65 | 65 |
|
66 | 66 |
# cinder doesn't always clean up the volume group as it might be used elsewhere... |
... | ... |
@@ -32,9 +32,9 @@ source $TOP_DIR/functions |
32 | 32 |
# Import configuration |
33 | 33 |
source $TOP_DIR/openrc |
34 | 34 |
|
35 |
-# Import quantum functions if needed |
|
36 |
-if is_service_enabled quantum; then |
|
37 |
- source $TOP_DIR/lib/quantum |
|
35 |
+# Import neutron functions if needed |
|
36 |
+if is_service_enabled neutron; then |
|
37 |
+ source $TOP_DIR/lib/neutron |
|
38 | 38 |
fi |
39 | 39 |
|
40 | 40 |
# Import exercise configuration |
... | ... |
@@ -33,9 +33,9 @@ source $TOP_DIR/functions |
33 | 33 |
# Import EC2 configuration |
34 | 34 |
source $TOP_DIR/eucarc |
35 | 35 |
|
36 |
-# Import quantum functions if needed |
|
37 |
-if is_service_enabled quantum; then |
|
38 |
- source $TOP_DIR/lib/quantum |
|
36 |
+# Import neutron functions if needed |
|
37 |
+if is_service_enabled neutron; then |
|
38 |
+ source $TOP_DIR/lib/neutron |
|
39 | 39 |
fi |
40 | 40 |
|
41 | 41 |
# Import exercise configuration |
... | ... |
@@ -30,9 +30,9 @@ source $TOP_DIR/functions |
30 | 30 |
# Import configuration |
31 | 31 |
source $TOP_DIR/openrc |
32 | 32 |
|
33 |
-# Import quantum functions if needed |
|
34 |
-if is_service_enabled quantum; then |
|
35 |
- source $TOP_DIR/lib/quantum |
|
33 |
+# Import neutron functions if needed |
|
34 |
+if is_service_enabled neutron; then |
|
35 |
+ source $TOP_DIR/lib/neutron |
|
36 | 36 |
fi |
37 | 37 |
|
38 | 38 |
# Import exercise configuration |
... | ... |
@@ -155,7 +155,7 @@ nova add-floating-ip $VM_UUID $FLOATING_IP || \ |
155 | 155 |
# Test we can ping our floating IP within ASSOCIATE_TIMEOUT seconds |
156 | 156 |
ping_check "$PUBLIC_NETWORK_NAME" $FLOATING_IP $ASSOCIATE_TIMEOUT |
157 | 157 |
|
158 |
-if ! is_service_enabled quantum; then |
|
158 |
+if ! is_service_enabled neutron; then |
|
159 | 159 |
# Allocate an IP from second floating pool |
160 | 160 |
TEST_FLOATING_IP=$(nova floating-ip-create $TEST_FLOATING_POOL | grep $TEST_FLOATING_POOL | get_field 1) |
161 | 161 |
die_if_not_set $LINENO TEST_FLOATING_IP "Failure creating floating IP in $TEST_FLOATING_POOL" |
... | ... |
@@ -179,7 +179,7 @@ fi |
179 | 179 |
# Clean up |
180 | 180 |
# -------- |
181 | 181 |
|
182 |
-if ! is_service_enabled quantum; then |
|
182 |
+if ! is_service_enabled neutron; then |
|
183 | 183 |
# Delete second floating IP |
184 | 184 |
nova floating-ip-delete $TEST_FLOATING_IP || \ |
185 | 185 |
die $LINENO "Failure deleting floating IP $TEST_FLOATING_IP" |
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
#!/usr/bin/env bash |
2 | 2 |
# |
3 | 3 |
|
4 |
-# **quantum-adv-test.sh** |
|
4 |
+# **neutron-adv-test.sh** |
|
5 | 5 |
|
6 |
-# Perform integration testing of Nova and other components with Quantum. |
|
6 |
+# Perform integration testing of Nova and other components with Neutron. |
|
7 | 7 |
|
8 | 8 |
echo "*********************************************************************" |
9 | 9 |
echo "Begin DevStack Exercise: $0" |
... | ... |
@@ -43,16 +43,16 @@ source $TOP_DIR/functions |
43 | 43 |
# Import configuration |
44 | 44 |
source $TOP_DIR/openrc |
45 | 45 |
|
46 |
-# Import quantum functions |
|
47 |
-source $TOP_DIR/lib/quantum |
|
46 |
+# Import neutron functions |
|
47 |
+source $TOP_DIR/lib/neutron |
|
48 | 48 |
|
49 |
-# If quantum is not enabled we exit with exitcode 55, which means exercise is skipped. |
|
50 |
-quantum_plugin_check_adv_test_requirements || exit 55 |
|
49 |
+# If neutron is not enabled we exit with exitcode 55, which means exercise is skipped. |
|
50 |
+neutron_plugin_check_adv_test_requirements || exit 55 |
|
51 | 51 |
|
52 | 52 |
# Import exercise configuration |
53 | 53 |
source $TOP_DIR/exerciserc |
54 | 54 |
|
55 |
-# Quantum Settings |
|
55 |
+# Neutron Settings |
|
56 | 56 |
# ---------------- |
57 | 57 |
|
58 | 58 |
TENANTS="DEMO1" |
... | ... |
@@ -161,7 +161,7 @@ function get_role_id { |
161 | 161 |
|
162 | 162 |
function get_network_id { |
163 | 163 |
local NETWORK_NAME="$1" |
164 |
- local NETWORK_ID=`quantum net-list -F id -- --name=$NETWORK_NAME | awk "NR==4" | awk '{print $2}'` |
|
164 |
+ local NETWORK_ID=`neutron net-list -F id -- --name=$NETWORK_NAME | awk "NR==4" | awk '{print $2}'` |
|
165 | 165 |
echo $NETWORK_ID |
166 | 166 |
} |
167 | 167 |
|
... | ... |
@@ -232,9 +232,9 @@ function create_network { |
232 | 232 |
source $TOP_DIR/openrc admin admin |
233 | 233 |
local TENANT_ID=$(get_tenant_id $TENANT) |
234 | 234 |
source $TOP_DIR/openrc $TENANT $TENANT |
235 |
- local NET_ID=$(quantum net-create --tenant_id $TENANT_ID $NET_NAME $EXTRA| grep ' id ' | awk '{print $4}' ) |
|
236 |
- quantum subnet-create --ip_version 4 --tenant_id $TENANT_ID --gateway $GATEWAY $NET_ID $CIDR |
|
237 |
- quantum-debug probe-create --device-owner compute $NET_ID |
|
235 |
+ local NET_ID=$(neutron net-create --tenant_id $TENANT_ID $NET_NAME $EXTRA| grep ' id ' | awk '{print $4}' ) |
|
236 |
+ neutron subnet-create --ip_version 4 --tenant_id $TENANT_ID --gateway $GATEWAY $NET_ID $CIDR |
|
237 |
+ neutron-debug probe-create --device-owner compute $NET_ID |
|
238 | 238 |
source $TOP_DIR/openrc demo demo |
239 | 239 |
} |
240 | 240 |
|
... | ... |
@@ -320,10 +320,10 @@ function delete_network { |
320 | 320 |
local TENANT_ID=$(get_tenant_id $TENANT) |
321 | 321 |
#TODO(nati) comment out until l3-agent merged |
322 | 322 |
#for res in port subnet net router;do |
323 |
- for net_id in `quantum net-list -c id -c name | grep $NET_NAME | awk '{print $2}'`;do |
|
323 |
+ for net_id in `neutron net-list -c id -c name | grep $NET_NAME | awk '{print $2}'`;do |
|
324 | 324 |
delete_probe $net_id |
325 |
- quantum subnet-list | grep $net_id | awk '{print $2}' | xargs -I% quantum subnet-delete % |
|
326 |
- quantum net-delete $net_id |
|
325 |
+ neutron subnet-list | grep $net_id | awk '{print $2}' | xargs -I% neutron subnet-delete % |
|
326 |
+ neutron net-delete $net_id |
|
327 | 327 |
done |
328 | 328 |
source $TOP_DIR/openrc demo demo |
329 | 329 |
} |
... | ... |
@@ -30,9 +30,9 @@ source $TOP_DIR/functions |
30 | 30 |
# Import configuration |
31 | 31 |
source $TOP_DIR/openrc |
32 | 32 |
|
33 |
-# Import quantum functions if needed |
|
34 |
-if is_service_enabled quantum; then |
|
35 |
- source $TOP_DIR/lib/quantum |
|
33 |
+# Import neutron functions if needed |
|
34 |
+if is_service_enabled neutron; then |
|
35 |
+ source $TOP_DIR/lib/neutron |
|
36 | 36 |
fi |
37 | 37 |
|
38 | 38 |
# Import exercise configuration |
... | ... |
@@ -262,8 +262,8 @@ function get_packages() { |
262 | 262 |
file_to_parse="${file_to_parse} keystone" |
263 | 263 |
fi |
264 | 264 |
elif [[ $service == q-* ]]; then |
265 |
- if [[ ! $file_to_parse =~ quantum ]]; then |
|
266 |
- file_to_parse="${file_to_parse} quantum" |
|
265 |
+ if [[ ! $file_to_parse =~ neutron ]]; then |
|
266 |
+ file_to_parse="${file_to_parse} neutron" |
|
267 | 267 |
fi |
268 | 268 |
fi |
269 | 269 |
done |
... | ... |
@@ -717,7 +717,7 @@ function is_running() { |
717 | 717 |
# **cinder** returns true if any service enabled start with **c-** |
718 | 718 |
# **ceilometer** returns true if any service enabled start with **ceilometer** |
719 | 719 |
# **glance** returns true if any service enabled start with **g-** |
720 |
-# **quantum** returns true if any service enabled start with **q-** |
|
720 |
+# **neutron** returns true if any service enabled start with **q-** |
|
721 | 721 |
# **swift** returns true if any service enabled start with **s-** |
722 | 722 |
# For backward compatibility if we have **swift** in ENABLED_SERVICES all the |
723 | 723 |
# **s-** services will be enabled. This will be deprecated in the future. |
... | ... |
@@ -732,7 +732,7 @@ function is_service_enabled() { |
732 | 732 |
[[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && return 0 |
733 | 733 |
[[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && return 0 |
734 | 734 |
[[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0 |
735 |
- [[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0 |
|
735 |
+ [[ ${service} == "neutron" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0 |
|
736 | 736 |
[[ ${service} == "swift" && ${ENABLED_SERVICES} =~ "s-" ]] && return 0 |
737 | 737 |
[[ ${service} == s-* && ${ENABLED_SERVICES} =~ "swift" ]] && return 0 |
738 | 738 |
done |
... | ... |
@@ -758,7 +758,7 @@ function _cleanup_service_list () { |
758 | 758 |
# enable_service qpid |
759 | 759 |
# |
760 | 760 |
# This function does not know about the special cases |
761 |
-# for nova, glance, and quantum built into is_service_enabled(). |
|
761 |
+# for nova, glance, and neutron built into is_service_enabled(). |
|
762 | 762 |
# Uses global ``ENABLED_SERVICES`` |
763 | 763 |
# enable_service service [service ...] |
764 | 764 |
function enable_service() { |
... | ... |
@@ -780,7 +780,7 @@ function enable_service() { |
780 | 780 |
# disable_service rabbit |
781 | 781 |
# |
782 | 782 |
# This function does not know about the special cases |
783 |
-# for nova, glance, and quantum built into is_service_enabled(). |
|
783 |
+# for nova, glance, and neutron built into is_service_enabled(). |
|
784 | 784 |
# Uses global ``ENABLED_SERVICES`` |
785 | 785 |
# disable_service service [service ...] |
786 | 786 |
function disable_service() { |
... | ... |
@@ -1330,8 +1330,8 @@ function zypper_install() { |
1330 | 1330 |
# Uses globals ``ENABLED_SERVICES`` |
1331 | 1331 |
# ping_check from-net ip boot-timeout expected |
1332 | 1332 |
function ping_check() { |
1333 |
- if is_service_enabled quantum; then |
|
1334 |
- _ping_check_quantum "$1" $2 $3 $4 |
|
1333 |
+ if is_service_enabled neutron; then |
|
1334 |
+ _ping_check_neutron "$1" $2 $3 $4 |
|
1335 | 1335 |
return |
1336 | 1336 |
fi |
1337 | 1337 |
_ping_check_novanet "$1" $2 $3 $4 |
... | ... |
@@ -1370,8 +1370,8 @@ function _ping_check_novanet() { |
1370 | 1370 |
|
1371 | 1371 |
# ssh_check net-name key-file floating-ip default-user active-timeout |
1372 | 1372 |
function ssh_check() { |
1373 |
- if is_service_enabled quantum; then |
|
1374 |
- _ssh_check_quantum "$1" $2 $3 $4 $5 |
|
1373 |
+ if is_service_enabled neutron; then |
|
1374 |
+ _ssh_check_neutron "$1" $2 $3 $4 $5 |
|
1375 | 1375 |
return |
1376 | 1376 |
fi |
1377 | 1377 |
_ssh_check_novanet "$1" $2 $3 $4 $5 |
... | ... |
@@ -151,12 +151,12 @@ function configure_keystone() { |
151 | 151 |
echo "catalog.RegionOne.object_store.name = Swift Service" >> $KEYSTONE_CATALOG |
152 | 152 |
fi |
153 | 153 |
|
154 |
- # Add quantum endpoints to service catalog if quantum is enabled |
|
155 |
- if is_service_enabled quantum; then |
|
154 |
+ # Add neutron endpoints to service catalog if neutron is enabled |
|
155 |
+ if is_service_enabled neutron; then |
|
156 | 156 |
echo "catalog.RegionOne.network.publicURL = http://%SERVICE_HOST%:$Q_PORT/" >> $KEYSTONE_CATALOG |
157 | 157 |
echo "catalog.RegionOne.network.adminURL = http://%SERVICE_HOST%:$Q_PORT/" >> $KEYSTONE_CATALOG |
158 | 158 |
echo "catalog.RegionOne.network.internalURL = http://%SERVICE_HOST%:$Q_PORT/" >> $KEYSTONE_CATALOG |
159 |
- echo "catalog.RegionOne.network.name = Quantum Service" >> $KEYSTONE_CATALOG |
|
159 |
+ echo "catalog.RegionOne.network.name = Neutron Service" >> $KEYSTONE_CATALOG |
|
160 | 160 |
fi |
161 | 161 |
|
162 | 162 |
sed -e " |
163 | 163 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,815 @@ |
0 |
+# lib/neutron |
|
1 |
+# functions - funstions specific to neutron |
|
2 |
+ |
|
3 |
+# Dependencies: |
|
4 |
+# ``functions`` file |
|
5 |
+# ``DEST`` must be defined |
|
6 |
+ |
|
7 |
+# ``stack.sh`` calls the entry points in this order: |
|
8 |
+# |
|
9 |
+# install_neutron |
|
10 |
+# install_neutronclient |
|
11 |
+# install_neutron_agent_packages |
|
12 |
+# install_neutron_third_party |
|
13 |
+# configure_neutron |
|
14 |
+# init_neutron |
|
15 |
+# configure_neutron_third_party |
|
16 |
+# init_neutron_third_party |
|
17 |
+# start_neutron_third_party |
|
18 |
+# create_nova_conf_neutron |
|
19 |
+# start_neutron_service_and_check |
|
20 |
+# create_neutron_initial_network |
|
21 |
+# setup_neutron_debug |
|
22 |
+# start_neutron_agents |
|
23 |
+# |
|
24 |
+# ``unstack.sh`` calls the entry points in this order: |
|
25 |
+# |
|
26 |
+# stop_neutron |
|
27 |
+ |
|
28 |
+# Functions in lib/neutron are classified into the following categories: |
|
29 |
+# |
|
30 |
+# - entry points (called from stack.sh or unstack.sh) |
|
31 |
+# - internal functions |
|
32 |
+# - neutron exercises |
|
33 |
+# - 3rd party programs |
|
34 |
+ |
|
35 |
+ |
|
36 |
+# Neutron Networking |
|
37 |
+# ------------------ |
|
38 |
+ |
|
39 |
+# Make sure that neutron is enabled in ``ENABLED_SERVICES``. If you want |
|
40 |
+# to run Neutron on this host, make sure that q-svc is also in |
|
41 |
+# ``ENABLED_SERVICES``. |
|
42 |
+# |
|
43 |
+# If you're planning to use the Neutron openvswitch plugin, set |
|
44 |
+# ``Q_PLUGIN`` to "openvswitch" and make sure the q-agt service is enabled |
|
45 |
+# in ``ENABLED_SERVICES``. If you're planning to use the Neutron |
|
46 |
+# linuxbridge plugin, set ``Q_PLUGIN`` to "linuxbridge" and make sure the |
|
47 |
+# q-agt service is enabled in ``ENABLED_SERVICES``. |
|
48 |
+# |
|
49 |
+# See "Neutron Network Configuration" below for additional variables |
|
50 |
+# that must be set in localrc for connectivity across hosts with |
|
51 |
+# Neutron. |
|
52 |
+# |
|
53 |
+# With Neutron networking the NETWORK_MANAGER variable is ignored. |
|
54 |
+# |
|
55 |
+# To enable specific configuration options for either the Open vSwitch or |
|
56 |
+# LinuxBridge plugin, please see the top level README file under the |
|
57 |
+# Neutron section. |
|
58 |
+ |
|
59 |
+# Save trace setting |
|
60 |
+XTRACE=$(set +o | grep xtrace) |
|
61 |
+set +o xtrace |
|
62 |
+ |
|
63 |
+ |
|
64 |
+# Neutron Network Configuration |
|
65 |
+# ----------------------------- |
|
66 |
+ |
|
67 |
+# Gateway and subnet defaults, in case they are not customized in localrc |
|
68 |
+NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1} |
|
69 |
+PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.225} |
|
70 |
+PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"} |
|
71 |
+PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"} |
|
72 |
+ |
|
73 |
+# Set up default directories |
|
74 |
+NEUTRON_DIR=$DEST/neutron |
|
75 |
+NEUTRONCLIENT_DIR=$DEST/python-neutronclient |
|
76 |
+NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron} |
|
77 |
+ |
|
78 |
+# Support entry points installation of console scripts |
|
79 |
+if [[ -d $NEUTRON_DIR/bin/neutron-server ]]; then |
|
80 |
+ NEUTRON_BIN_DIR=$NEUTRON_DIR/bin |
|
81 |
+ else |
|
82 |
+NEUTRON_BIN_DIR=$(get_python_exec_prefix) |
|
83 |
+fi |
|
84 |
+ |
|
85 |
+NEUTRON_CONF_DIR=/etc/neutron |
|
86 |
+NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf |
|
87 |
+export NEUTRON_TEST_CONFIG_FILE=${NEUTRON_TEST_CONFIG_FILE:-"$NEUTRON_CONF_DIR/debug.ini"} |
|
88 |
+ |
|
89 |
+# Default Neutron Plugin |
|
90 |
+Q_PLUGIN=${Q_PLUGIN:-openvswitch} |
|
91 |
+# Default Neutron Port |
|
92 |
+Q_PORT=${Q_PORT:-9696} |
|
93 |
+# Default Neutron Host |
|
94 |
+Q_HOST=${Q_HOST:-$SERVICE_HOST} |
|
95 |
+# Default admin username |
|
96 |
+Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-neutron} |
|
97 |
+# Default auth strategy |
|
98 |
+Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone} |
|
99 |
+# Use namespace or not |
|
100 |
+Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True} |
|
101 |
+# RHEL's support for namespaces requires using veths with ovs |
|
102 |
+Q_OVS_USE_VETH=${Q_OVS_USE_VETH:-False} |
|
103 |
+Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True} |
|
104 |
+# Meta data IP |
|
105 |
+Q_META_DATA_IP=${Q_META_DATA_IP:-$SERVICE_HOST} |
|
106 |
+# Allow Overlapping IP among subnets |
|
107 |
+Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True} |
|
108 |
+# Use neutron-debug command |
|
109 |
+Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False} |
|
110 |
+# The name of the default q-l3 router |
|
111 |
+Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1} |
|
112 |
+# List of config file names in addition to the main plugin config file |
|
113 |
+# See _configure_neutron_common() for details about setting it up |
|
114 |
+declare -a Q_PLUGIN_EXTRA_CONF_FILES |
|
115 |
+ |
|
116 |
+if is_service_enabled neutron; then |
|
117 |
+ Q_RR_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf |
|
118 |
+ if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then |
|
119 |
+ Q_RR_COMMAND="sudo" |
|
120 |
+ else |
|
121 |
+ NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron) |
|
122 |
+ Q_RR_COMMAND="sudo $NEUTRON_ROOTWRAP $Q_RR_CONF_FILE" |
|
123 |
+ fi |
|
124 |
+ |
|
125 |
+ # Provider Network Configurations |
|
126 |
+ # -------------------------------- |
|
127 |
+ |
|
128 |
+ # The following variables control the Neutron openvswitch and |
|
129 |
+ # linuxbridge plugins' allocation of tenant networks and |
|
130 |
+ # availability of provider networks. If these are not configured |
|
131 |
+ # in ``localrc``, tenant networks will be local to the host (with no |
|
132 |
+ # remote connectivity), and no physical resources will be |
|
133 |
+ # available for the allocation of provider networks. |
|
134 |
+ |
|
135 |
+ # To use GRE tunnels for tenant networks, set to True in |
|
136 |
+ # ``localrc``. GRE tunnels are only supported by the openvswitch |
|
137 |
+ # plugin, and currently only on Ubuntu. |
|
138 |
+ ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False} |
|
139 |
+ |
|
140 |
+ # If using GRE tunnels for tenant networks, specify the range of |
|
141 |
+ # tunnel IDs from which tenant networks are allocated. Can be |
|
142 |
+ # overriden in ``localrc`` in necesssary. |
|
143 |
+ TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGE:-1:1000} |
|
144 |
+ |
|
145 |
+ # To use VLANs for tenant networks, set to True in localrc. VLANs |
|
146 |
+ # are supported by the openvswitch and linuxbridge plugins, each |
|
147 |
+ # requiring additional configuration described below. |
|
148 |
+ ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False} |
|
149 |
+ |
|
150 |
+ # If using VLANs for tenant networks, set in ``localrc`` to specify |
|
151 |
+ # the range of VLAN VIDs from which tenant networks are |
|
152 |
+ # allocated. An external network switch must be configured to |
|
153 |
+ # trunk these VLANs between hosts for multi-host connectivity. |
|
154 |
+ # |
|
155 |
+ # Example: ``TENANT_VLAN_RANGE=1000:1999`` |
|
156 |
+ TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-} |
|
157 |
+ |
|
158 |
+ # If using VLANs for tenant networks, or if using flat or VLAN |
|
159 |
+ # provider networks, set in ``localrc`` to the name of the physical |
|
160 |
+ # network, and also configure ``OVS_PHYSICAL_BRIDGE`` for the |
|
161 |
+ # openvswitch agent or ``LB_PHYSICAL_INTERFACE`` for the linuxbridge |
|
162 |
+ # agent, as described below. |
|
163 |
+ # |
|
164 |
+ # Example: ``PHYSICAL_NETWORK=default`` |
|
165 |
+ PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-} |
|
166 |
+ |
|
167 |
+ # With the openvswitch plugin, if using VLANs for tenant networks, |
|
168 |
+ # or if using flat or VLAN provider networks, set in ``localrc`` to |
|
169 |
+ # the name of the OVS bridge to use for the physical network. The |
|
170 |
+ # bridge will be created if it does not already exist, but a |
|
171 |
+ # physical interface must be manually added to the bridge as a |
|
172 |
+ # port for external connectivity. |
|
173 |
+ # |
|
174 |
+ # Example: ``OVS_PHYSICAL_BRIDGE=br-eth1`` |
|
175 |
+ OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-} |
|
176 |
+ |
|
177 |
+ # With the linuxbridge plugin, if using VLANs for tenant networks, |
|
178 |
+ # or if using flat or VLAN provider networks, set in ``localrc`` to |
|
179 |
+ # the name of the network interface to use for the physical |
|
180 |
+ # network. |
|
181 |
+ # |
|
182 |
+ # Example: ``LB_PHYSICAL_INTERFACE=eth1`` |
|
183 |
+ LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-} |
|
184 |
+ |
|
185 |
+ # With the openvswitch plugin, set to True in ``localrc`` to enable |
|
186 |
+ # provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False. |
|
187 |
+ # |
|
188 |
+ # Example: ``OVS_ENABLE_TUNNELING=True`` |
|
189 |
+ OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS} |
|
190 |
+fi |
|
191 |
+ |
|
192 |
+# Neutron plugin specific functions |
|
193 |
+# --------------------------------- |
|
194 |
+ |
|
195 |
+# Please refer to ``lib/neutron_plugins/README.md`` for details. |
|
196 |
+source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN |
|
197 |
+ |
|
198 |
+# Agent loadbalancer service plugin functions |
|
199 |
+# ------------------------------------------- |
|
200 |
+ |
|
201 |
+# Hardcoding for 1 service plugin for now |
|
202 |
+source $TOP_DIR/lib/neutron_plugins/services/loadbalancer |
|
203 |
+ |
|
204 |
+# Use security group or not |
|
205 |
+if has_neutron_plugin_security_group; then |
|
206 |
+ Q_USE_SECGROUP=${Q_USE_SECGROUP:-True} |
|
207 |
+else |
|
208 |
+ Q_USE_SECGROUP=False |
|
209 |
+fi |
|
210 |
+ |
|
211 |
+# Functions |
|
212 |
+# --------- |
|
213 |
+ |
|
214 |
+# configure_neutron() |
|
215 |
+# Set common config for all neutron server and agents. |
|
216 |
+function configure_neutron() { |
|
217 |
+ _configure_neutron_common |
|
218 |
+ iniset_rpc_backend neutron $NEUTRON_CONF DEFAULT |
|
219 |
+ |
|
220 |
+ # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES |
|
221 |
+ if is_service_enabled q-lbaas; then |
|
222 |
+ _configure_neutron_lbaas |
|
223 |
+ fi |
|
224 |
+ if is_service_enabled q-svc; then |
|
225 |
+ _configure_neutron_service |
|
226 |
+ fi |
|
227 |
+ if is_service_enabled q-agt; then |
|
228 |
+ _configure_neutron_plugin_agent |
|
229 |
+ fi |
|
230 |
+ if is_service_enabled q-dhcp; then |
|
231 |
+ _configure_neutron_dhcp_agent |
|
232 |
+ fi |
|
233 |
+ if is_service_enabled q-l3; then |
|
234 |
+ _configure_neutron_l3_agent |
|
235 |
+ fi |
|
236 |
+ if is_service_enabled q-meta; then |
|
237 |
+ _configure_neutron_metadata_agent |
|
238 |
+ fi |
|
239 |
+ |
|
240 |
+ _configure_neutron_debug_command |
|
241 |
+} |
|
242 |
+ |
|
243 |
+function create_nova_conf_neutron() { |
|
244 |
+ iniset $NOVA_CONF DEFAULT network_api_class "nova.network.quantumv2.api.API" |
|
245 |
+ iniset $NOVA_CONF DEFAULT quantum_admin_username "$Q_ADMIN_USERNAME" |
|
246 |
+ iniset $NOVA_CONF DEFAULT quantum_admin_password "$SERVICE_PASSWORD" |
|
247 |
+ iniset $NOVA_CONF DEFAULT quantum_admin_auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0" |
|
248 |
+ iniset $NOVA_CONF DEFAULT quantum_auth_strategy "$Q_AUTH_STRATEGY" |
|
249 |
+ iniset $NOVA_CONF DEFAULT quantum_admin_tenant_name "$SERVICE_TENANT_NAME" |
|
250 |
+ iniset $NOVA_CONF DEFAULT quantum_url "http://$Q_HOST:$Q_PORT" |
|
251 |
+ |
|
252 |
+ if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
253 |
+ LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver |
|
254 |
+ iniset $NOVA_CONF DEFAULT security_group_api quantum |
|
255 |
+ fi |
|
256 |
+ |
|
257 |
+ # set NOVA_VIF_DRIVER and optionally set options in nova_conf |
|
258 |
+ neutron_plugin_create_nova_conf |
|
259 |
+ |
|
260 |
+ iniset $NOVA_CONF DEFAULT libvirt_vif_driver "$NOVA_VIF_DRIVER" |
|
261 |
+ iniset $NOVA_CONF DEFAULT linuxnet_interface_driver "$LINUXNET_VIF_DRIVER" |
|
262 |
+ if is_service_enabled q-meta; then |
|
263 |
+ iniset $NOVA_CONF DEFAULT service_quantum_metadata_proxy "True" |
|
264 |
+ fi |
|
265 |
+} |
|
266 |
+ |
|
267 |
+# create_neutron_accounts() - Set up common required neutron accounts |
|
268 |
+ |
|
269 |
+# Tenant User Roles |
|
270 |
+# ------------------------------------------------------------------ |
|
271 |
+# service neutron admin # if enabled |
|
272 |
+ |
|
273 |
+# Migrated from keystone_data.sh |
|
274 |
+function create_neutron_accounts() { |
|
275 |
+ |
|
276 |
+ SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }") |
|
277 |
+ ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }") |
|
278 |
+ |
|
279 |
+ if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then |
|
280 |
+ NEUTRON_USER=$(keystone user-create \ |
|
281 |
+ --name=neutron \ |
|
282 |
+ --pass="$SERVICE_PASSWORD" \ |
|
283 |
+ --tenant_id $SERVICE_TENANT \ |
|
284 |
+ --email=neutron@example.com \ |
|
285 |
+ | grep " id " | get_field 2) |
|
286 |
+ keystone user-role-add \ |
|
287 |
+ --tenant_id $SERVICE_TENANT \ |
|
288 |
+ --user_id $NEUTRON_USER \ |
|
289 |
+ --role_id $ADMIN_ROLE |
|
290 |
+ if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
|
291 |
+ NEUTRON_SERVICE=$(keystone service-create \ |
|
292 |
+ --name=neutron \ |
|
293 |
+ --type=network \ |
|
294 |
+ --description="Neutron Service" \ |
|
295 |
+ | grep " id " | get_field 2) |
|
296 |
+ keystone endpoint-create \ |
|
297 |
+ --region RegionOne \ |
|
298 |
+ --service_id $NEUTRON_SERVICE \ |
|
299 |
+ --publicurl "http://$SERVICE_HOST:9696/" \ |
|
300 |
+ --adminurl "http://$SERVICE_HOST:9696/" \ |
|
301 |
+ --internalurl "http://$SERVICE_HOST:9696/" |
|
302 |
+ fi |
|
303 |
+ fi |
|
304 |
+} |
|
305 |
+ |
|
306 |
+function create_neutron_initial_network() { |
|
307 |
+ TENANT_ID=$(keystone tenant-list | grep " demo " | get_field 1) |
|
308 |
+ |
|
309 |
+ # Create a small network |
|
310 |
+ # Since neutron command is executed in admin context at this point, |
|
311 |
+ # ``--tenant_id`` needs to be specified. |
|
312 |
+ if is_baremetal; then |
|
313 |
+ sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE |
|
314 |
+ for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do |
|
315 |
+ sudo ip addr del $IP dev $PUBLIC_INTERFACE |
|
316 |
+ sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE |
|
317 |
+ done |
|
318 |
+ NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2) |
|
319 |
+ SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) |
|
320 |
+ sudo ifconfig $OVS_PHYSICAL_BRIDGE up |
|
321 |
+ else |
|
322 |
+ NET_ID=$(neutron net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2) |
|
323 |
+ SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) |
|
324 |
+ fi |
|
325 |
+ |
|
326 |
+ if [[ "$Q_L3_ENABLED" == "True" ]]; then |
|
327 |
+ # Create a router, and add the private subnet as one of its interfaces |
|
328 |
+ if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then |
|
329 |
+ # create a tenant-owned router. |
|
330 |
+ ROUTER_ID=$(neutron router-create --tenant_id $TENANT_ID $Q_ROUTER_NAME | grep ' id ' | get_field 2) |
|
331 |
+ else |
|
332 |
+ # Plugin only supports creating a single router, which should be admin owned. |
|
333 |
+ ROUTER_ID=$(neutron router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2) |
|
334 |
+ fi |
|
335 |
+ neutron router-interface-add $ROUTER_ID $SUBNET_ID |
|
336 |
+ # Create an external network, and a subnet. Configure the external network as router gw |
|
337 |
+ EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2) |
|
338 |
+ EXT_GW_IP=$(neutron subnet-create --ip_version 4 ${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} --gateway $PUBLIC_NETWORK_GATEWAY --name $PUBLIC_SUBNET_NAME $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2) |
|
339 |
+ neutron router-gateway-set $ROUTER_ID $EXT_NET_ID |
|
340 |
+ |
|
341 |
+ if is_service_enabled q-l3; then |
|
342 |
+ # logic is specific to using the l3-agent for l3 |
|
343 |
+ if is_neutron_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then |
|
344 |
+ CIDR_LEN=${FLOATING_RANGE#*/} |
|
345 |
+ sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE |
|
346 |
+ sudo ip link set $PUBLIC_BRIDGE up |
|
347 |
+ ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'` |
|
348 |
+ sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP |
|
349 |
+ fi |
|
350 |
+ if [[ "$Q_USE_NAMESPACE" == "False" ]]; then |
|
351 |
+ # Explicitly set router id in l3 agent configuration |
|
352 |
+ iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID |
|
353 |
+ fi |
|
354 |
+ fi |
|
355 |
+ fi |
|
356 |
+} |
|
357 |
+ |
|
358 |
+# init_neutron() - Initialize databases, etc. |
|
359 |
+function init_neutron() { |
|
360 |
+ : |
|
361 |
+} |
|
362 |
+ |
|
363 |
+# install_neutron() - Collect source and prepare |
|
364 |
+function install_neutron() { |
|
365 |
+ git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH |
|
366 |
+ setup_develop $NEUTRON_DIR |
|
367 |
+} |
|
368 |
+ |
|
369 |
+# install_neutronclient() - Collect source and prepare |
|
370 |
+function install_neutronclient() { |
|
371 |
+ git_clone $NEUTRONCLIENT_REPO $NEUTRONCLIENT_DIR $NEUTRONCLIENT_BRANCH |
|
372 |
+ setup_develop $NEUTRONCLIENT_DIR |
|
373 |
+} |
|
374 |
+ |
|
375 |
+# install_neutron_agent_packages() - Collect source and prepare |
|
376 |
+function install_neutron_agent_packages() { |
|
377 |
+ # install packages that are specific to plugin agent(s) |
|
378 |
+ if is_service_enabled q-agt q-dhcp q-l3; then |
|
379 |
+ neutron_plugin_install_agent_packages |
|
380 |
+ fi |
|
381 |
+ |
|
382 |
+ if is_service_enabled q-lbaas; then |
|
383 |
+ neutron_agent_lbaas_install_agent_packages |
|
384 |
+ fi |
|
385 |
+} |
|
386 |
+ |
|
387 |
+# Start running processes, including screen |
|
388 |
+function start_neutron_service_and_check() { |
|
389 |
+ # build config-file options |
|
390 |
+ local cfg_file |
|
391 |
+ local CFG_FILE_OPTIONS="--config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
392 |
+ for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do |
|
393 |
+ CFG_FILE_OPTIONS+=" --config-file /$cfg_file" |
|
394 |
+ done |
|
395 |
+ # Start the Neutron service |
|
396 |
+ screen_it q-svc "cd $NEUTRON_DIR && python $NEUTRON_BIN_DIR/neutron-server $CFG_FILE_OPTIONS" |
|
397 |
+ echo "Waiting for Neutron to start..." |
|
398 |
+ if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then |
|
399 |
+ die $LINENO "Neutron did not start" |
|
400 |
+ fi |
|
401 |
+} |
|
402 |
+ |
|
403 |
+# Start running processes, including screen |
|
404 |
+function start_neutron_agents() { |
|
405 |
+ # Start up the neutron agents if enabled |
|
406 |
+ screen_it q-agt "cd $NEUTRON_DIR && python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
407 |
+ screen_it q-dhcp "cd $NEUTRON_DIR && python $AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE" |
|
408 |
+ screen_it q-l3 "cd $NEUTRON_DIR && python $AGENT_L3_BINARY --config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE" |
|
409 |
+ screen_it q-meta "cd $NEUTRON_DIR && python $AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file=$Q_META_CONF_FILE" |
|
410 |
+ |
|
411 |
+ if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
412 |
+ # For XenServer, start an agent for the domU openvswitch |
|
413 |
+ screen_it q-domua "cd $NEUTRON_DIR && python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE.domU" |
|
414 |
+ fi |
|
415 |
+ |
|
416 |
+ if is_service_enabled q-lbaas; then |
|
417 |
+ screen_it q-lbaas "cd $NEUTRON_DIR && python $AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME" |
|
418 |
+ fi |
|
419 |
+} |
|
420 |
+ |
|
421 |
+# stop_neutron() - Stop running processes (non-screen) |
|
422 |
+function stop_neutron() { |
|
423 |
+ if is_service_enabled q-dhcp; then |
|
424 |
+ pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }') |
|
425 |
+ [ ! -z "$pid" ] && sudo kill -9 $pid |
|
426 |
+ fi |
|
427 |
+ if is_service_enabled q-meta; then |
|
428 |
+ pid=$(ps aux | awk '/neutron-ns-metadata-proxy/ { print $2 }') |
|
429 |
+ [ ! -z "$pid" ] && sudo kill -9 $pid |
|
430 |
+ fi |
|
431 |
+} |
|
432 |
+ |
|
433 |
+# cleanup_neutron() - Remove residual data files, anything left over from previous |
|
434 |
+# runs that a clean run would need to clean up |
|
435 |
+function cleanup_neutron() { |
|
436 |
+ if is_neutron_ovs_base_plugin; then |
|
437 |
+ neutron_ovs_base_cleanup |
|
438 |
+ fi |
|
439 |
+ |
|
440 |
+ # delete all namespaces created by neutron |
|
441 |
+ for ns in $(sudo ip netns list | grep -o -e qdhcp-[0-9a-f\-]* -e qrouter-[0-9a-f\-]*); do |
|
442 |
+ sudo ip netns delete ${ns} |
|
443 |
+ done |
|
444 |
+} |
|
445 |
+ |
|
446 |
+# _configure_neutron_common() |
|
447 |
+# Set common config for all neutron server and agents. |
|
448 |
+# This MUST be called before other ``_configure_neutron_*`` functions. |
|
449 |
+function _configure_neutron_common() { |
|
450 |
+ # Put config files in ``NEUTRON_CONF_DIR`` for everyone to find |
|
451 |
+ if [[ ! -d $NEUTRON_CONF_DIR ]]; then |
|
452 |
+ sudo mkdir -p $NEUTRON_CONF_DIR |
|
453 |
+ fi |
|
454 |
+ sudo chown $STACK_USER $NEUTRON_CONF_DIR |
|
455 |
+ |
|
456 |
+ cp $NEUTRON_DIR/etc/neutron.conf $NEUTRON_CONF |
|
457 |
+ |
|
458 |
+ # Set plugin-specific variables ``Q_DB_NAME``, ``Q_PLUGIN_CLASS``. |
|
459 |
+ # For main plugin config file, set ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``. |
|
460 |
+ # For addition plugin config files, set ``Q_PLUGIN_EXTRA_CONF_PATH``, |
|
461 |
+ # ``Q_PLUGIN_EXTRA_CONF_FILES``. For example: |
|
462 |
+ # ``Q_PLUGIN_EXTRA_CONF_FILES=(file1, file2)`` |
|
463 |
+ neutron_plugin_configure_common |
|
464 |
+ |
|
465 |
+ if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then |
|
466 |
+ die $LINENO "Neutron plugin not set.. exiting" |
|
467 |
+ fi |
|
468 |
+ |
|
469 |
+ # If needed, move config file from ``$NEUTRON_DIR/etc/neutron`` to ``NEUTRON_CONF_DIR`` |
|
470 |
+ mkdir -p /$Q_PLUGIN_CONF_PATH |
|
471 |
+ Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME |
|
472 |
+ cp $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE |
|
473 |
+ |
|
474 |
+ iniset /$Q_PLUGIN_CONF_FILE database connection `database_connection_url $Q_DB_NAME` |
|
475 |
+ iniset $NEUTRON_CONF DEFAULT state_path $DATA_DIR/neutron |
|
476 |
+ |
|
477 |
+ # If addition config files are set, make sure their path name is set as well |
|
478 |
+ if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then |
|
479 |
+ die $LINENO "Neutron additional plugin config not set.. exiting" |
|
480 |
+ fi |
|
481 |
+ |
|
482 |
+ # If additional config files exist, copy them over to neutron configuration |
|
483 |
+ # directory |
|
484 |
+ if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then |
|
485 |
+ mkdir -p /$Q_PLUGIN_EXTRA_CONF_PATH |
|
486 |
+ local f |
|
487 |
+ for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do |
|
488 |
+ Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]} |
|
489 |
+ cp $NEUTRON_DIR/${Q_PLUGIN_EXTRA_CONF_FILES[$f]} /${Q_PLUGIN_EXTRA_CONF_FILES[$f]} |
|
490 |
+ done |
|
491 |
+ fi |
|
492 |
+ |
|
493 |
+ _neutron_setup_rootwrap |
|
494 |
+} |
|
495 |
+ |
|
496 |
+function _configure_neutron_debug_command() { |
|
497 |
+ if [[ "$Q_USE_DEBUG_COMMAND" != "True" ]]; then |
|
498 |
+ return |
|
499 |
+ fi |
|
500 |
+ |
|
501 |
+ cp $NEUTRON_DIR/etc/l3_agent.ini $NEUTRON_TEST_CONFIG_FILE |
|
502 |
+ |
|
503 |
+ iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT verbose False |
|
504 |
+ iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT debug False |
|
505 |
+ iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
506 |
+ iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
507 |
+ # Intermediate fix until Neutron patch lands and then line above will |
|
508 |
+ # be cleaned. |
|
509 |
+ iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper "$Q_RR_COMMAND" |
|
510 |
+ |
|
511 |
+ _neutron_setup_keystone $NEUTRON_TEST_CONFIG_FILE DEFAULT set_auth_url |
|
512 |
+ _neutron_setup_interface_driver $NEUTRON_TEST_CONFIG_FILE |
|
513 |
+ |
|
514 |
+ neutron_plugin_configure_debug_command |
|
515 |
+} |
|
516 |
+ |
|
517 |
+function _configure_neutron_dhcp_agent() { |
|
518 |
+ AGENT_DHCP_BINARY="$NEUTRON_BIN_DIR/neutron-dhcp-agent" |
|
519 |
+ Q_DHCP_CONF_FILE=$NEUTRON_CONF_DIR/dhcp_agent.ini |
|
520 |
+ |
|
521 |
+ cp $NEUTRON_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE |
|
522 |
+ |
|
523 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT verbose True |
|
524 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT debug True |
|
525 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
526 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
527 |
+ |
|
528 |
+ _neutron_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url |
|
529 |
+ _neutron_setup_interface_driver $Q_DHCP_CONF_FILE |
|
530 |
+ |
|
531 |
+ neutron_plugin_configure_dhcp_agent |
|
532 |
+} |
|
533 |
+ |
|
534 |
+function _configure_neutron_l3_agent() { |
|
535 |
+ Q_L3_ENABLED=True |
|
536 |
+ # for l3-agent, only use per tenant router if we have namespaces |
|
537 |
+ Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE |
|
538 |
+ AGENT_L3_BINARY="$NEUTRON_BIN_DIR/neutron-l3-agent" |
|
539 |
+ Q_L3_CONF_FILE=$NEUTRON_CONF_DIR/l3_agent.ini |
|
540 |
+ |
|
541 |
+ cp $NEUTRON_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE |
|
542 |
+ |
|
543 |
+ iniset $Q_L3_CONF_FILE DEFAULT verbose True |
|
544 |
+ iniset $Q_L3_CONF_FILE DEFAULT debug True |
|
545 |
+ iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
546 |
+ iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
547 |
+ |
|
548 |
+ _neutron_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url |
|
549 |
+ _neutron_setup_interface_driver $Q_L3_CONF_FILE |
|
550 |
+ |
|
551 |
+ neutron_plugin_configure_l3_agent |
|
552 |
+} |
|
553 |
+ |
|
554 |
+function _configure_neutron_metadata_agent() { |
|
555 |
+ AGENT_META_BINARY="$NEUTRON_BIN_DIR/neutron-metadata-agent" |
|
556 |
+ Q_META_CONF_FILE=$NEUTRON_CONF_DIR/metadata_agent.ini |
|
557 |
+ |
|
558 |
+ cp $NEUTRON_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE |
|
559 |
+ |
|
560 |
+ iniset $Q_META_CONF_FILE DEFAULT verbose True |
|
561 |
+ iniset $Q_META_CONF_FILE DEFAULT debug True |
|
562 |
+ iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP |
|
563 |
+ iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
564 |
+ |
|
565 |
+ _neutron_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url |
|
566 |
+} |
|
567 |
+ |
|
568 |
+function _configure_neutron_lbaas() { |
|
569 |
+ neutron_agent_lbaas_configure_common |
|
570 |
+ neutron_agent_lbaas_configure_agent |
|
571 |
+} |
|
572 |
+ |
|
573 |
+# _configure_neutron_plugin_agent() - Set config files for neutron plugin agent |
|
574 |
+# It is called when q-agt is enabled. |
|
575 |
+function _configure_neutron_plugin_agent() { |
|
576 |
+ # Specify the default root helper prior to agent configuration to |
|
577 |
+ # ensure that an agent's configuration can override the default |
|
578 |
+ iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_COMMAND" |
|
579 |
+ iniset $NEUTRON_CONF DEFAULT verbose True |
|
580 |
+ iniset $NEUTRON_CONF DEFAULT debug True |
|
581 |
+ |
|
582 |
+ # Configure agent for plugin |
|
583 |
+ neutron_plugin_configure_plugin_agent |
|
584 |
+} |
|
585 |
+ |
|
586 |
+# _configure_neutron_service() - Set config files for neutron service |
|
587 |
+# It is called when q-svc is enabled. |
|
588 |
+function _configure_neutron_service() { |
|
589 |
+ Q_API_PASTE_FILE=$NEUTRON_CONF_DIR/api-paste.ini |
|
590 |
+ Q_POLICY_FILE=$NEUTRON_CONF_DIR/policy.json |
|
591 |
+ |
|
592 |
+ cp $NEUTRON_DIR/etc/api-paste.ini $Q_API_PASTE_FILE |
|
593 |
+ cp $NEUTRON_DIR/etc/policy.json $Q_POLICY_FILE |
|
594 |
+ |
|
595 |
+ if is_service_enabled $DATABASE_BACKENDS; then |
|
596 |
+ recreate_database $Q_DB_NAME utf8 |
|
597 |
+ else |
|
598 |
+ die $LINENO "A database must be enabled in order to use the $Q_PLUGIN Neutron plugin." |
|
599 |
+ fi |
|
600 |
+ |
|
601 |
+ # Update either configuration file with plugin |
|
602 |
+ iniset $NEUTRON_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS |
|
603 |
+ |
|
604 |
+ if [[ $Q_SERVICE_PLUGIN_CLASSES != '' ]]; then |
|
605 |
+ iniset $NEUTRON_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES |
|
606 |
+ fi |
|
607 |
+ |
|
608 |
+ iniset $NEUTRON_CONF DEFAULT verbose True |
|
609 |
+ iniset $NEUTRON_CONF DEFAULT debug True |
|
610 |
+ iniset $NEUTRON_CONF DEFAULT policy_file $Q_POLICY_FILE |
|
611 |
+ iniset $NEUTRON_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP |
|
612 |
+ |
|
613 |
+ iniset $NEUTRON_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY |
|
614 |
+ _neutron_setup_keystone $NEUTRON_CONF keystone_authtoken |
|
615 |
+ |
|
616 |
+ # Configure plugin |
|
617 |
+ neutron_plugin_configure_service |
|
618 |
+} |
|
619 |
+ |
|
620 |
+# Utility Functions |
|
621 |
+#------------------ |
|
622 |
+ |
|
623 |
+# _neutron_setup_rootwrap() - configure Neutron's rootwrap |
|
624 |
+function _neutron_setup_rootwrap() { |
|
625 |
+ if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then |
|
626 |
+ return |
|
627 |
+ fi |
|
628 |
+ # Deploy new rootwrap filters files (owned by root). |
|
629 |
+ # Wipe any existing ``rootwrap.d`` files first |
|
630 |
+ Q_CONF_ROOTWRAP_D=$NEUTRON_CONF_DIR/rootwrap.d |
|
631 |
+ if [[ -d $Q_CONF_ROOTWRAP_D ]]; then |
|
632 |
+ sudo rm -rf $Q_CONF_ROOTWRAP_D |
|
633 |
+ fi |
|
634 |
+ # Deploy filters to ``$NEUTRON_CONF_DIR/rootwrap.d`` |
|
635 |
+ mkdir -p -m 755 $Q_CONF_ROOTWRAP_D |
|
636 |
+ cp -pr $NEUTRON_DIR/etc/neutron/rootwrap.d/* $Q_CONF_ROOTWRAP_D/ |
|
637 |
+ sudo chown -R root:root $Q_CONF_ROOTWRAP_D |
|
638 |
+ sudo chmod 644 $Q_CONF_ROOTWRAP_D/* |
|
639 |
+ # Set up ``rootwrap.conf``, pointing to ``$NEUTRON_CONF_DIR/rootwrap.d`` |
|
640 |
+ # location moved in newer versions, prefer new location |
|
641 |
+ if test -r $NEUTRON_DIR/etc/neutron/rootwrap.conf; then |
|
642 |
+ sudo cp -p $NEUTRON_DIR/etc/neutron/rootwrap.conf $Q_RR_CONF_FILE |
|
643 |
+ else |
|
644 |
+ sudo cp -p $NEUTRON_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE |
|
645 |
+ fi |
|
646 |
+ sudo sed -e "s:^filters_path=.*$:filters_path=$Q_CONF_ROOTWRAP_D:" -i $Q_RR_CONF_FILE |
|
647 |
+ sudo chown root:root $Q_RR_CONF_FILE |
|
648 |
+ sudo chmod 0644 $Q_RR_CONF_FILE |
|
649 |
+ # Specify ``rootwrap.conf`` as first parameter to neutron-rootwrap |
|
650 |
+ ROOTWRAP_SUDOER_CMD="$NEUTRON_ROOTWRAP $Q_RR_CONF_FILE *" |
|
651 |
+ |
|
652 |
+ # Set up the rootwrap sudoers for neutron |
|
653 |
+ TEMPFILE=`mktemp` |
|
654 |
+ echo "$USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE |
|
655 |
+ chmod 0440 $TEMPFILE |
|
656 |
+ sudo chown root:root $TEMPFILE |
|
657 |
+ sudo mv $TEMPFILE /etc/sudoers.d/neutron-rootwrap |
|
658 |
+ |
|
659 |
+ # Update the root_helper |
|
660 |
+ iniset $NEUTRON_CONF agent root_helper "$Q_RR_COMMAND" |
|
661 |
+} |
|
662 |
+ |
|
663 |
+# Configures keystone integration for neutron service and agents |
|
664 |
+function _neutron_setup_keystone() { |
|
665 |
+ local conf_file=$1 |
|
666 |
+ local section=$2 |
|
667 |
+ local use_auth_url=$3 |
|
668 |
+ if [[ -n $use_auth_url ]]; then |
|
669 |
+ iniset $conf_file $section auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0" |
|
670 |
+ else |
|
671 |
+ iniset $conf_file $section auth_host $KEYSTONE_SERVICE_HOST |
|
672 |
+ iniset $conf_file $section auth_port $KEYSTONE_AUTH_PORT |
|
673 |
+ iniset $conf_file $section auth_protocol $KEYSTONE_SERVICE_PROTOCOL |
|
674 |
+ fi |
|
675 |
+ iniset $conf_file $section admin_tenant_name $SERVICE_TENANT_NAME |
|
676 |
+ iniset $conf_file $section admin_user $Q_ADMIN_USERNAME |
|
677 |
+ iniset $conf_file $section admin_password $SERVICE_PASSWORD |
|
678 |
+ iniset $conf_file $section signing_dir $NEUTRON_AUTH_CACHE_DIR |
|
679 |
+ # Create cache dir |
|
680 |
+ sudo mkdir -p $NEUTRON_AUTH_CACHE_DIR |
|
681 |
+ sudo chown $STACK_USER $NEUTRON_AUTH_CACHE_DIR |
|
682 |
+ rm -f $NEUTRON_AUTH_CACHE_DIR/* |
|
683 |
+} |
|
684 |
+ |
|
685 |
+function _neutron_setup_interface_driver() { |
|
686 |
+ |
|
687 |
+ # ovs_use_veth needs to be set before the plugin configuration |
|
688 |
+ # occurs to allow plugins to override the setting. |
|
689 |
+ iniset $1 DEFAULT ovs_use_veth $Q_OVS_USE_VETH |
|
690 |
+ |
|
691 |
+ neutron_plugin_setup_interface_driver $1 |
|
692 |
+} |
|
693 |
+ |
|
694 |
+# Functions for Neutron Exercises |
|
695 |
+#-------------------------------- |
|
696 |
+ |
|
697 |
+function delete_probe() { |
|
698 |
+ local from_net="$1" |
|
699 |
+ net_id=`_get_net_id $from_net` |
|
700 |
+ probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'` |
|
701 |
+ neutron-debug --os-tenant-name admin --os-username admin probe-delete $probe_id |
|
702 |
+} |
|
703 |
+ |
|
704 |
+function setup_neutron_debug() { |
|
705 |
+ if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then |
|
706 |
+ public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME` |
|
707 |
+ neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $public_net_id |
|
708 |
+ private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME` |
|
709 |
+ neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $private_net_id |
|
710 |
+ fi |
|
711 |
+} |
|
712 |
+ |
|
713 |
+function teardown_neutron_debug() { |
|
714 |
+ delete_probe $PUBLIC_NETWORK_NAME |
|
715 |
+ delete_probe $PRIVATE_NETWORK_NAME |
|
716 |
+} |
|
717 |
+ |
|
718 |
+function _get_net_id() { |
|
719 |
+ neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}' |
|
720 |
+} |
|
721 |
+ |
|
722 |
+function _get_probe_cmd_prefix() { |
|
723 |
+ local from_net="$1" |
|
724 |
+ net_id=`_get_net_id $from_net` |
|
725 |
+ probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}' | head -n 1` |
|
726 |
+ echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id" |
|
727 |
+} |
|
728 |
+ |
|
729 |
+function _ping_check_neutron() { |
|
730 |
+ local from_net=$1 |
|
731 |
+ local ip=$2 |
|
732 |
+ local timeout_sec=$3 |
|
733 |
+ local expected=${4:-"True"} |
|
734 |
+ local check_command="" |
|
735 |
+ probe_cmd=`_get_probe_cmd_prefix $from_net` |
|
736 |
+ if [[ "$expected" = "True" ]]; then |
|
737 |
+ check_command="while ! $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done" |
|
738 |
+ else |
|
739 |
+ check_command="while $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done" |
|
740 |
+ fi |
|
741 |
+ if ! timeout $timeout_sec sh -c "$check_command"; then |
|
742 |
+ if [[ "$expected" = "True" ]]; then |
|
743 |
+ die $LINENO "[Fail] Couldn't ping server" |
|
744 |
+ else |
|
745 |
+ die $LINENO "[Fail] Could ping server" |
|
746 |
+ fi |
|
747 |
+ fi |
|
748 |
+} |
|
749 |
+ |
|
750 |
+# ssh check |
|
751 |
+function _ssh_check_neutron() { |
|
752 |
+ local from_net=$1 |
|
753 |
+ local key_file=$2 |
|
754 |
+ local ip=$3 |
|
755 |
+ local user=$4 |
|
756 |
+ local timeout_sec=$5 |
|
757 |
+ local probe_cmd = "" |
|
758 |
+ probe_cmd=`_get_probe_cmd_prefix $from_net` |
|
759 |
+ if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success; do sleep 1; done"; then |
|
760 |
+ die $LINENO "server didn't become ssh-able!" |
|
761 |
+ fi |
|
762 |
+} |
|
763 |
+ |
|
764 |
+# Neutron 3rd party programs |
|
765 |
+#--------------------------- |
|
766 |
+ |
|
767 |
+# please refer to ``lib/neutron_thirdparty/README.md`` for details |
|
768 |
+NEUTRON_THIRD_PARTIES="" |
|
769 |
+for f in $TOP_DIR/lib/neutron_thirdparty/*; do |
|
770 |
+ third_party=$(basename $f) |
|
771 |
+ if is_service_enabled $third_party; then |
|
772 |
+ source $TOP_DIR/lib/neutron_thirdparty/$third_party |
|
773 |
+ NEUTRON_THIRD_PARTIES="$NEUTRON_THIRD_PARTIES,$third_party" |
|
774 |
+ fi |
|
775 |
+done |
|
776 |
+ |
|
777 |
+function _neutron_third_party_do() { |
|
778 |
+ for third_party in ${NEUTRON_THIRD_PARTIES//,/ }; do |
|
779 |
+ ${1}_${third_party} |
|
780 |
+ done |
|
781 |
+} |
|
782 |
+ |
|
783 |
+# configure_neutron_third_party() - Set config files, create data dirs, etc |
|
784 |
+function configure_neutron_third_party() { |
|
785 |
+ _neutron_third_party_do configure |
|
786 |
+} |
|
787 |
+ |
|
788 |
+# init_neutron_third_party() - Initialize databases, etc. |
|
789 |
+function init_neutron_third_party() { |
|
790 |
+ _neutron_third_party_do init |
|
791 |
+} |
|
792 |
+ |
|
793 |
+# install_neutron_third_party() - Collect source and prepare |
|
794 |
+function install_neutron_third_party() { |
|
795 |
+ _neutron_third_party_do install |
|
796 |
+} |
|
797 |
+ |
|
798 |
+# start_neutron_third_party() - Start running processes, including screen |
|
799 |
+function start_neutron_third_party() { |
|
800 |
+ _neutron_third_party_do start |
|
801 |
+} |
|
802 |
+ |
|
803 |
+# stop_neutron_third_party - Stop running processes (non-screen) |
|
804 |
+function stop_neutron_third_party() { |
|
805 |
+ _neutron_third_party_do stop |
|
806 |
+} |
|
807 |
+ |
|
808 |
+ |
|
809 |
+# Restore xtrace |
|
810 |
+$XTRACE |
|
811 |
+ |
|
812 |
+# Local variables: |
|
813 |
+# mode: shell-script |
|
814 |
+# End: |
0 | 815 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,38 @@ |
0 |
+Neutron plugin specific files |
|
1 |
+============================= |
|
2 |
+Neutron plugins require plugin specific behavior. |
|
3 |
+The files under the directory, ``lib/neutron_plugins/``, will be used |
|
4 |
+when their service is enabled. |
|
5 |
+Each plugin has ``lib/neutron_plugins/$Q_PLUGIN`` and define the following |
|
6 |
+functions. |
|
7 |
+Plugin specific configuration variables should be in this file. |
|
8 |
+ |
|
9 |
+* filename: ``$Q_PLUGIN`` |
|
10 |
+ * The corresponding file name MUST be the same to plugin name ``$Q_PLUGIN``. |
|
11 |
+ Plugin specific configuration variables should be in this file. |
|
12 |
+ |
|
13 |
+functions |
|
14 |
+--------- |
|
15 |
+``lib/neutron`` calls the following functions when the ``$Q_PLUGIN`` is enabled |
|
16 |
+ |
|
17 |
+* ``neutron_plugin_create_nova_conf`` : |
|
18 |
+ set ``NOVA_VIF_DRIVER`` and optionally set options in nova_conf |
|
19 |
+ e.g. |
|
20 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
21 |
+* ``neutron_plugin_install_agent_packages`` : |
|
22 |
+ install packages that is specific to plugin agent |
|
23 |
+ e.g. |
|
24 |
+ install_package bridge-utils |
|
25 |
+* ``neutron_plugin_configure_common`` : |
|
26 |
+ set plugin-specific variables, ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``, |
|
27 |
+ ``Q_DB_NAME``, ``Q_PLUGIN_CLASS`` |
|
28 |
+* ``neutron_plugin_configure_debug_command`` |
|
29 |
+* ``neutron_plugin_configure_dhcp_agent`` |
|
30 |
+* ``neutron_plugin_configure_l3_agent`` |
|
31 |
+* ``neutron_plugin_configure_plugin_agent`` |
|
32 |
+* ``neutron_plugin_configure_service`` |
|
33 |
+* ``neutron_plugin_setup_interface_driver`` |
|
34 |
+* ``has_neutron_plugin_security_group``: |
|
35 |
+ return 0 if the plugin support neutron security group otherwise return 1 |
|
36 |
+* ``neutron_plugin_check_adv_test_requirements``: |
|
37 |
+ return 0 if requirements are satisfied otherwise return 1 |
0 | 38 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,74 @@ |
0 |
+# Neuton Big Switch/FloodLight 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 |
+source $TOP_DIR/lib/neutron_thirdparty/bigswitch_floodlight # for third party service specific configuration values |
|
9 |
+ |
|
10 |
+function neutron_plugin_create_nova_conf() { |
|
11 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
12 |
+} |
|
13 |
+ |
|
14 |
+function neutron_plugin_install_agent_packages() { |
|
15 |
+ _neutron_ovs_base_install_agent_packages |
|
16 |
+} |
|
17 |
+ |
|
18 |
+function neutron_plugin_configure_common() { |
|
19 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/bigswitch |
|
20 |
+ Q_PLUGIN_CONF_FILENAME=restproxy.ini |
|
21 |
+ Q_DB_NAME="restproxy_neutron" |
|
22 |
+ Q_PLUGIN_CLASS="neutron.plugins.bigswitch.plugin.NeutronRestProxyV2" |
|
23 |
+ BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80} |
|
24 |
+ BS_FL_CONTROLLER_TIMEOUT=${BS_FL_CONTROLLER_TIMEOUT:-10} |
|
25 |
+} |
|
26 |
+ |
|
27 |
+function neutron_plugin_configure_debug_command() { |
|
28 |
+ _neutron_ovs_base_configure_debug_command |
|
29 |
+} |
|
30 |
+ |
|
31 |
+function neutron_plugin_configure_dhcp_agent() { |
|
32 |
+ : |
|
33 |
+} |
|
34 |
+ |
|
35 |
+function neutron_plugin_configure_l3_agent() { |
|
36 |
+ _neutron_ovs_base_configure_l3_agent |
|
37 |
+} |
|
38 |
+ |
|
39 |
+function neutron_plugin_configure_plugin_agent() { |
|
40 |
+ : |
|
41 |
+} |
|
42 |
+ |
|
43 |
+function neutron_plugin_configure_service() { |
|
44 |
+ iniset /$Q_PLUGIN_CONF_FILE restproxy servers $BS_FL_CONTROLLERS_PORT |
|
45 |
+ iniset /$Q_PLUGIN_CONF_FILE restproxy servertimeout $BS_FL_CONTROLLER_TIMEOUT |
|
46 |
+ if [ "$BS_FL_VIF_DRIVER" = "ivs" ] |
|
47 |
+ then |
|
48 |
+ iniset /$Q_PLUGIN_CONF_FILE nova vif_type ivs |
|
49 |
+ fi |
|
50 |
+} |
|
51 |
+ |
|
52 |
+function neutron_plugin_setup_interface_driver() { |
|
53 |
+ local conf_file=$1 |
|
54 |
+ if [ "$BS_FL_VIF_DRIVER" = "ivs" ] |
|
55 |
+ then |
|
56 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.IVSInterfaceDriver |
|
57 |
+ else |
|
58 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
|
59 |
+ fi |
|
60 |
+} |
|
61 |
+ |
|
62 |
+ |
|
63 |
+function has_neutron_plugin_security_group() { |
|
64 |
+ # 1 means False here |
|
65 |
+ return 1 |
|
66 |
+} |
|
67 |
+ |
|
68 |
+function neutron_plugin_check_adv_test_requirements() { |
|
69 |
+ is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
70 |
+} |
|
71 |
+ |
|
72 |
+# Restore xtrace |
|
73 |
+$MY_XTRACE |
0 | 74 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,59 @@ |
0 |
+# Brocade Neutron Plugin |
|
1 |
+# ---------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+BRCD_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+function is_neutron_ovs_base_plugin() { |
|
8 |
+ return 1 |
|
9 |
+} |
|
10 |
+ |
|
11 |
+function neutron_plugin_create_nova_conf() { |
|
12 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
13 |
+} |
|
14 |
+ |
|
15 |
+function neutron_plugin_install_agent_packages() { |
|
16 |
+ install_package bridge-utils |
|
17 |
+} |
|
18 |
+ |
|
19 |
+function neutron_plugin_configure_common() { |
|
20 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/brocade |
|
21 |
+ Q_PLUGIN_CONF_FILENAME=brocade.ini |
|
22 |
+ Q_DB_NAME="brcd_neutron" |
|
23 |
+ Q_PLUGIN_CLASS="neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2" |
|
24 |
+} |
|
25 |
+ |
|
26 |
+function neutron_plugin_configure_debug_command() { |
|
27 |
+ iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge |
|
28 |
+} |
|
29 |
+ |
|
30 |
+function neutron_plugin_configure_dhcp_agent() { |
|
31 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport |
|
32 |
+} |
|
33 |
+ |
|
34 |
+function neutron_plugin_configure_l3_agent() { |
|
35 |
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge |
|
36 |
+ iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport |
|
37 |
+} |
|
38 |
+ |
|
39 |
+function neutron_plugin_configure_plugin_agent() { |
|
40 |
+ AGENT_BINARY="$NEUTON_BIN_DIR/neutron-linuxbridge-agent" |
|
41 |
+} |
|
42 |
+ |
|
43 |
+function neutron_plugin_setup_interface_driver() { |
|
44 |
+ local conf_file=$1 |
|
45 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver |
|
46 |
+} |
|
47 |
+ |
|
48 |
+function has_neutron_plugin_security_group() { |
|
49 |
+ # 0 means True here |
|
50 |
+ return 0 |
|
51 |
+} |
|
52 |
+ |
|
53 |
+function neutron_plugin_check_adv_test_requirements() { |
|
54 |
+ is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
55 |
+} |
|
56 |
+ |
|
57 |
+# Restore xtrace |
|
58 |
+$BRCD_XTRACE |
0 | 59 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,327 @@ |
0 |
+# Neutron Cisco plugin |
|
1 |
+# --------------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+# Scecify the VSM parameters |
|
8 |
+Q_CISCO_PLUGIN_VSM_IP=${Q_CISCO_PLUGIN_VSM_IP:-} |
|
9 |
+# Specify the VSM username |
|
10 |
+Q_CISCO_PLUGIN_VSM_USERNAME=${Q_CISCO_PLUGIN_VSM_USERNAME:-admin} |
|
11 |
+# Specify the VSM passward for above username |
|
12 |
+Q_CISCO_PLUGIN_VSM_PASSWORD=${Q_CISCO_PLUGIN_VSM_PASSWORD:-} |
|
13 |
+# Specify the uVEM integration bridge name |
|
14 |
+Q_CISCO_PLUGIN_INTEGRATION_BRIDGE=${Q_CISCO_PLUGIN_INTEGRATION_BRIDGE:-br-int} |
|
15 |
+# Specify if tunneling is enabled |
|
16 |
+Q_CISCO_PLUGIN_ENABLE_TUNNELING=${Q_CISCO_PLUGIN_ENABLE_TUNNELING:-True} |
|
17 |
+# Specify the VXLAN range |
|
18 |
+Q_CISCO_PLUGIN_VXLAN_ID_RANGES=${Q_CISCO_PLUGIN_VXLAN_ID_RANGES:-5000:10000} |
|
19 |
+# Specify the VLAN range |
|
20 |
+Q_CISCO_PLUGIN_VLAN_RANGES=${Q_CISCO_PLUGIN_VLAN_RANGES:-vlan:1:4094} |
|
21 |
+ |
|
22 |
+# Specify ncclient package information |
|
23 |
+NCCLIENT_DIR=$DEST/ncclient |
|
24 |
+NCCLIENT_VERSION=${NCCLIENT_VERSION:-0.3.1} |
|
25 |
+NCCLIENT_REPO=${NCCLIENT_REPO:-${GIT_BASE}/CiscoSystems/ncclient.git} |
|
26 |
+NCCLIENT_BRANCH=${NCCLIENT_BRANCH:-master} |
|
27 |
+ |
|
28 |
+# This routine put a prefix on an existing function name |
|
29 |
+function _prefix_function() { |
|
30 |
+ declare -F $1 > /dev/null || die "$1 doesn't exist" |
|
31 |
+ eval "$(echo "${2}_${1}()"; declare -f ${1} | tail -n +2)" |
|
32 |
+} |
|
33 |
+ |
|
34 |
+function _has_ovs_subplugin() { |
|
35 |
+ local subplugin |
|
36 |
+ for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do |
|
37 |
+ if [[ "$subplugin" == "openvswitch" ]]; then |
|
38 |
+ return 0 |
|
39 |
+ fi |
|
40 |
+ done |
|
41 |
+ return 1 |
|
42 |
+} |
|
43 |
+ |
|
44 |
+function _has_nexus_subplugin() { |
|
45 |
+ local subplugin |
|
46 |
+ for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do |
|
47 |
+ if [[ "$subplugin" == "nexus" ]]; then |
|
48 |
+ return 0 |
|
49 |
+ fi |
|
50 |
+ done |
|
51 |
+ return 1 |
|
52 |
+} |
|
53 |
+ |
|
54 |
+function _has_n1kv_subplugin() { |
|
55 |
+ local subplugin |
|
56 |
+ for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do |
|
57 |
+ if [[ "$subplugin" == "n1kv" ]]; then |
|
58 |
+ return 0 |
|
59 |
+ fi |
|
60 |
+ done |
|
61 |
+ return 1 |
|
62 |
+} |
|
63 |
+ |
|
64 |
+# This routine populates the cisco config file with the information for |
|
65 |
+# a particular nexus switch |
|
66 |
+function _config_switch() { |
|
67 |
+ local cisco_cfg_file=$1 |
|
68 |
+ local switch_ip=$2 |
|
69 |
+ local username=$3 |
|
70 |
+ local password=$4 |
|
71 |
+ local ssh_port=$5 |
|
72 |
+ shift 5 |
|
73 |
+ |
|
74 |
+ local section="NEXUS_SWITCH:$switch_ip" |
|
75 |
+ iniset $cisco_cfg_file $section username $username |
|
76 |
+ iniset $cisco_cfg_file $section password $password |
|
77 |
+ iniset $cisco_cfg_file $section ssh_port $ssh_port |
|
78 |
+ |
|
79 |
+ while [[ ${#@} != 0 ]]; do |
|
80 |
+ iniset $cisco_cfg_file $section $1 $2 |
|
81 |
+ shift 2 |
|
82 |
+ done |
|
83 |
+} |
|
84 |
+ |
|
85 |
+# Prefix openvswitch plugin routines with "ovs" in order to differentiate from |
|
86 |
+# cisco plugin routines. This means, ovs plugin routines will coexist with cisco |
|
87 |
+# plugin routines in this script. |
|
88 |
+source $TOP_DIR/lib/neutron_plugins/openvswitch |
|
89 |
+_prefix_function neutron_plugin_create_nova_conf ovs |
|
90 |
+_prefix_function neutron_plugin_install_agent_packages ovs |
|
91 |
+_prefix_function neutron_plugin_configure_common ovs |
|
92 |
+_prefix_function neutron_plugin_configure_debug_command ovs |
|
93 |
+_prefix_function neutron_plugin_configure_dhcp_agent ovs |
|
94 |
+_prefix_function neutron_plugin_configure_l3_agent ovs |
|
95 |
+_prefix_function neutron_plugin_configure_plugin_agent ovs |
|
96 |
+_prefix_function neutron_plugin_configure_service ovs |
|
97 |
+_prefix_function neutron_plugin_setup_interface_driver ovs |
|
98 |
+_prefix_function has_neutron_plugin_security_group ovs |
|
99 |
+ |
|
100 |
+# Check the version of the installed ncclient package |
|
101 |
+function check_ncclient_version() { |
|
102 |
+python << EOF |
|
103 |
+version = '$NCCLIENT_VERSION' |
|
104 |
+import sys |
|
105 |
+try: |
|
106 |
+ import pkg_resources |
|
107 |
+ import ncclient |
|
108 |
+ module_version = pkg_resources.get_distribution('ncclient').version |
|
109 |
+ if version != module_version: |
|
110 |
+ sys.exit(1) |
|
111 |
+except: |
|
112 |
+ sys.exit(1) |
|
113 |
+EOF |
|
114 |
+} |
|
115 |
+ |
|
116 |
+# Install the ncclient package |
|
117 |
+function install_ncclient() { |
|
118 |
+ git_clone $NCCLIENT_REPO $NCCLIENT_DIR $NCCLIENT_BRANCH |
|
119 |
+ (cd $NCCLIENT_DIR; sudo python setup.py install) |
|
120 |
+} |
|
121 |
+ |
|
122 |
+# Check if the required version of ncclient has been installed |
|
123 |
+function is_ncclient_installed() { |
|
124 |
+ # Check if the Cisco ncclient repository exists |
|
125 |
+ if [[ -d $NCCLIENT_DIR ]]; then |
|
126 |
+ remotes=$(cd $NCCLIENT_DIR; git remote -v | grep fetch | awk '{ print $2}') |
|
127 |
+ for remote in $remotes; do |
|
128 |
+ if [[ $remote == $NCCLIENT_REPO ]]; then |
|
129 |
+ break; |
|
130 |
+ fi |
|
131 |
+ done |
|
132 |
+ if [[ $remote != $NCCLIENT_REPO ]]; then |
|
133 |
+ return 1 |
|
134 |
+ fi |
|
135 |
+ else |
|
136 |
+ return 1 |
|
137 |
+ fi |
|
138 |
+ |
|
139 |
+ # Check if the ncclient is installed with the right version |
|
140 |
+ if ! check_ncclient_version; then |
|
141 |
+ return 1 |
|
142 |
+ fi |
|
143 |
+ return 0 |
|
144 |
+} |
|
145 |
+ |
|
146 |
+function has_neutron_plugin_security_group() { |
|
147 |
+ if _has_ovs_subplugin; then |
|
148 |
+ ovs_has_neutron_plugin_security_group |
|
149 |
+ else |
|
150 |
+ return 1 |
|
151 |
+ fi |
|
152 |
+} |
|
153 |
+ |
|
154 |
+function is_neutron_ovs_base_plugin() { |
|
155 |
+ # Cisco uses OVS if openvswitch subplugin is deployed |
|
156 |
+ _has_ovs_subplugin |
|
157 |
+ return |
|
158 |
+} |
|
159 |
+ |
|
160 |
+# populate required nova configuration parameters |
|
161 |
+function neutron_plugin_create_nova_conf() { |
|
162 |
+ if _has_ovs_subplugin; then |
|
163 |
+ ovs_neutron_plugin_create_nova_conf |
|
164 |
+ else |
|
165 |
+ _neutron_ovs_base_configure_nova_vif_driver |
|
166 |
+ fi |
|
167 |
+} |
|
168 |
+ |
|
169 |
+function neutron_plugin_install_agent_packages() { |
|
170 |
+ # Cisco plugin uses openvswitch to operate in one of its configurations |
|
171 |
+ ovs_neutron_plugin_install_agent_packages |
|
172 |
+} |
|
173 |
+ |
|
174 |
+# Configure common parameters |
|
175 |
+function neutron_plugin_configure_common() { |
|
176 |
+ # setup default subplugins |
|
177 |
+ if [ ! -v Q_CISCO_PLUGIN_SUBPLUGINS ]; then |
|
178 |
+ declare -ga Q_CISCO_PLUGIN_SUBPLUGINS |
|
179 |
+ Q_CISCO_PLUGIN_SUBPLUGINS=(openvswitch nexus) |
|
180 |
+ fi |
|
181 |
+ if _has_ovs_subplugin; then |
|
182 |
+ ovs_neutron_plugin_configure_common |
|
183 |
+ Q_PLUGIN_EXTRA_CONF_PATH=etc/neutron/plugins/cisco |
|
184 |
+ Q_PLUGIN_EXTRA_CONF_FILES=(cisco_plugins.ini) |
|
185 |
+ else |
|
186 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/cisco |
|
187 |
+ Q_PLUGIN_CONF_FILENAME=cisco_plugins.ini |
|
188 |
+ fi |
|
189 |
+ Q_PLUGIN_CLASS="neutron.plugins.cisco.network_plugin.PluginV2" |
|
190 |
+ Q_DB_NAME=cisco_neutron |
|
191 |
+} |
|
192 |
+ |
|
193 |
+function neutron_plugin_configure_debug_command() { |
|
194 |
+ if _has_ovs_subplugin; then |
|
195 |
+ ovs_neutron_plugin_configure_debug_command |
|
196 |
+ fi |
|
197 |
+} |
|
198 |
+ |
|
199 |
+function neutron_plugin_configure_dhcp_agent() { |
|
200 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport |
|
201 |
+} |
|
202 |
+ |
|
203 |
+function neutron_plugin_configure_l3_agent() { |
|
204 |
+ if _has_ovs_subplugin; then |
|
205 |
+ ovs_neutron_plugin_configure_l3_agent |
|
206 |
+ fi |
|
207 |
+} |
|
208 |
+ |
|
209 |
+function _configure_nexus_subplugin() { |
|
210 |
+ local cisco_cfg_file=$1 |
|
211 |
+ |
|
212 |
+ # Install a known compatible ncclient from the Cisco repository if necessary |
|
213 |
+ if ! is_ncclient_installed; then |
|
214 |
+ # Preserve the two global variables |
|
215 |
+ local offline=$OFFLINE |
|
216 |
+ local reclone=$RECLONE |
|
217 |
+ # Change their values to allow installation |
|
218 |
+ OFFLINE=False |
|
219 |
+ RECLONE=yes |
|
220 |
+ install_ncclient |
|
221 |
+ # Restore their values |
|
222 |
+ OFFLINE=$offline |
|
223 |
+ RECLONE=$reclone |
|
224 |
+ fi |
|
225 |
+ |
|
226 |
+ # Setup default nexus switch information |
|
227 |
+ if [ ! -v Q_CISCO_PLUGIN_SWITCH_INFO ]; then |
|
228 |
+ declare -A Q_CISCO_PLUGIN_SWITCH_INFO |
|
229 |
+ HOST_NAME=$(hostname) |
|
230 |
+ Q_CISCO_PLUGIN_SWITCH_INFO=([1.1.1.1]=stack:stack:22:${HOST_NAME}:1/10) |
|
231 |
+ else |
|
232 |
+ iniset $cisco_cfg_file CISCO nexus_driver neutron.plugins.cisco.nexus.cisco_nexus_network_driver_v2.CiscoNEXUSDriver |
|
233 |
+ fi |
|
234 |
+ |
|
235 |
+ # Setup the switch configurations |
|
236 |
+ local nswitch |
|
237 |
+ local sw_info |
|
238 |
+ local segment |
|
239 |
+ local sw_info_array |
|
240 |
+ declare -i count=0 |
|
241 |
+ for nswitch in ${!Q_CISCO_PLUGIN_SWITCH_INFO[@]}; do |
|
242 |
+ sw_info=${Q_CISCO_PLUGIN_SWITCH_INFO[$nswitch]} |
|
243 |
+ sw_info_array=${sw_info//:/ } |
|
244 |
+ sw_info_array=( $sw_info_array ) |
|
245 |
+ count=${#sw_info_array[@]} |
|
246 |
+ if [[ $count < 5 || $(( ($count-3) % 2 )) != 0 ]]; then |
|
247 |
+ die $LINENO "Incorrect switch configuration: ${Q_CISCO_PLUGIN_SWITCH_INFO[$nswitch]}" |
|
248 |
+ fi |
|
249 |
+ _config_switch $cisco_cfg_file $nswitch ${sw_info_array[@]} |
|
250 |
+ done |
|
251 |
+} |
|
252 |
+ |
|
253 |
+# Configure n1kv plugin |
|
254 |
+function _configure_n1kv_subplugin() { |
|
255 |
+ local cisco_cfg_file=$1 |
|
256 |
+ |
|
257 |
+ # populate the cisco plugin cfg file with the VSM information |
|
258 |
+ echo "Configuring n1kv in $cisco_cfg_file-- $Q_CISCO_PLUGIN_VSM_IP $Q_CISCO_PLUGIN_VSM_USERNAME $Q_CISCO_PLUGIN_VSM_PASSWORD" |
|
259 |
+ iniset $cisco_cfg_file N1KV:$Q_CISCO_PLUGIN_VSM_IP username $Q_CISCO_PLUGIN_VSM_USERNAME |
|
260 |
+ iniset $cisco_cfg_file N1KV:$Q_CISCO_PLUGIN_VSM_IP password $Q_CISCO_PLUGIN_VSM_PASSWORD |
|
261 |
+ |
|
262 |
+ iniset $cisco_cfg_file CISCO_N1K integration_bridge $Q_CISCO_PLUGIN_INTEGRATION_BRIDGE |
|
263 |
+ iniset $cisco_cfg_file CISCO_N1K enable_tunneling $Q_CISCO_PLUGIN_ENABLE_TUNNELING |
|
264 |
+ iniset $cisco_cfg_file CISCO_N1K vxlan_id_ranges $Q_CISCO_PLUGIN_VXLAN_ID_RANGES |
|
265 |
+ iniset $cisco_cfg_file CISCO_N1K network_vlan_ranges $Q_CISCO_PLUGIN_VLAN_RANGES |
|
266 |
+ |
|
267 |
+ # Setup the integration bridge by calling the ovs_base |
|
268 |
+ OVS_BRIDGE=$Q_CISCO_PLUGIN_INTEGRATION_BRIDGE |
|
269 |
+ _neutron_ovs_base_setup_bridge $OVS_BRIDGE |
|
270 |
+} |
|
271 |
+ |
|
272 |
+function neutron_plugin_configure_plugin_agent() { |
|
273 |
+ if _has_ovs_subplugin; then |
|
274 |
+ ovs_neutron_plugin_configure_plugin_agent |
|
275 |
+ fi |
|
276 |
+} |
|
277 |
+ |
|
278 |
+function neutron_plugin_configure_service() { |
|
279 |
+ local subplugin |
|
280 |
+ local cisco_cfg_file |
|
281 |
+ |
|
282 |
+ if _has_ovs_subplugin; then |
|
283 |
+ ovs_neutron_plugin_configure_service |
|
284 |
+ cisco_cfg_file=/${Q_PLUGIN_EXTRA_CONF_FILES[0]} |
|
285 |
+ else |
|
286 |
+ cisco_cfg_file=/$Q_PLUGIN_CONF_FILE |
|
287 |
+ fi |
|
288 |
+ |
|
289 |
+ # Setup the [CISCO_PLUGINS] section |
|
290 |
+ if [[ ${#Q_CISCO_PLUGIN_SUBPLUGINS[@]} > 2 ]]; then |
|
291 |
+ die $LINENO "At most two subplugins are supported." |
|
292 |
+ fi |
|
293 |
+ |
|
294 |
+ if _has_ovs_subplugin && _has_n1kv_subplugin; then |
|
295 |
+ die $LINENO "OVS subplugin and n1kv subplugin cannot coexist" |
|
296 |
+ fi |
|
297 |
+ |
|
298 |
+ # Setup the subplugins |
|
299 |
+ inicomment $cisco_cfg_file CISCO_PLUGINS nexus_plugin |
|
300 |
+ inicomment $cisco_cfg_file CISCO_PLUGINS vswitch_plugin |
|
301 |
+ inicomment $cisco_cfg_file CISCO_TEST host |
|
302 |
+ for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do |
|
303 |
+ case $subplugin in |
|
304 |
+ nexus) iniset $cisco_cfg_file CISCO_PLUGINS nexus_plugin neutron.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin;; |
|
305 |
+ openvswitch) iniset $cisco_cfg_file CISCO_PLUGINS vswitch_plugin neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2;; |
|
306 |
+ n1kv) iniset $cisco_cfg_file CISCO_PLUGINS vswitch_plugin neutron.plugins.cisco.n1kv.n1kv_neutron_plugin.N1kvNeutronPluginV2;; |
|
307 |
+ *) die $LINENO "Unsupported cisco subplugin: $subplugin";; |
|
308 |
+ esac |
|
309 |
+ done |
|
310 |
+ |
|
311 |
+ if _has_nexus_subplugin; then |
|
312 |
+ _configure_nexus_subplugin $cisco_cfg_file |
|
313 |
+ fi |
|
314 |
+ |
|
315 |
+ if _has_n1kv_subplugin; then |
|
316 |
+ _configure_n1kv_subplugin $cisco_cfg_file |
|
317 |
+ fi |
|
318 |
+} |
|
319 |
+ |
|
320 |
+function neutron_plugin_setup_interface_driver() { |
|
321 |
+ local conf_file=$1 |
|
322 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
|
323 |
+} |
|
324 |
+ |
|
325 |
+# Restore xtrace |
|
326 |
+$MY_XTRACE |
0 | 327 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,54 @@ |
0 |
+# Neutron Linux Bridge plugin |
|
1 |
+# --------------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+function neutron_plugin_configure_common() { |
|
8 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/linuxbridge |
|
9 |
+ Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini |
|
10 |
+ Q_DB_NAME="neutron_linux_bridge" |
|
11 |
+ Q_PLUGIN_CLASS="neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2" |
|
12 |
+} |
|
13 |
+ |
|
14 |
+function neutron_plugin_configure_service() { |
|
15 |
+ if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
16 |
+ iniset /$Q_PLUGIN_CONF_FILE vlans tenant_network_type vlan |
|
17 |
+ else |
|
18 |
+ echo "WARNING - The linuxbridge plugin is using local tenant networks, with no connectivity between hosts." |
|
19 |
+ fi |
|
20 |
+ |
|
21 |
+ # Override ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` |
|
22 |
+ # for more complex physical network configurations. |
|
23 |
+ if [[ "$LB_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
24 |
+ LB_VLAN_RANGES=$PHYSICAL_NETWORK |
|
25 |
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
26 |
+ LB_VLAN_RANGES=$LB_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
27 |
+ fi |
|
28 |
+ fi |
|
29 |
+ if [[ "$LB_VLAN_RANGES" != "" ]]; then |
|
30 |
+ iniset /$Q_PLUGIN_CONF_FILE vlans network_vlan_ranges $LB_VLAN_RANGES |
|
31 |
+ fi |
|
32 |
+ if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
33 |
+ iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver |
|
34 |
+ else |
|
35 |
+ iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver |
|
36 |
+ fi |
|
37 |
+ |
|
38 |
+ # Define extra "LINUX_BRIDGE" configuration options when q-svc is configured by defining |
|
39 |
+ # the array ``Q_SRV_EXTRA_OPTS``. |
|
40 |
+ # For Example: ``Q_SRV_EXTRA_OPTS=(foo=true bar=2)`` |
|
41 |
+ for I in "${Q_SRV_EXTRA_OPTS[@]}"; do |
|
42 |
+ # Replace the first '=' with ' ' for iniset syntax |
|
43 |
+ iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ } |
|
44 |
+ done |
|
45 |
+} |
|
46 |
+ |
|
47 |
+function has_neutron_plugin_security_group() { |
|
48 |
+ # 0 means True here |
|
49 |
+ return 0 |
|
50 |
+} |
|
51 |
+ |
|
52 |
+# Restore xtrace |
|
53 |
+$MY_XTRACE |
0 | 54 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,76 @@ |
0 |
+# Neutron Linux Bridge L2 agent |
|
1 |
+# ----------------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+PLUGIN_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+function is_neutron_ovs_base_plugin() { |
|
8 |
+ # linuxbridge doesn't use OVS |
|
9 |
+ return 1 |
|
10 |
+} |
|
11 |
+ |
|
12 |
+function neutron_plugin_create_nova_conf() { |
|
13 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
14 |
+} |
|
15 |
+ |
|
16 |
+function neutron_plugin_install_agent_packages() { |
|
17 |
+ install_package bridge-utils |
|
18 |
+} |
|
19 |
+ |
|
20 |
+function neutron_plugin_configure_debug_command() { |
|
21 |
+ iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge |
|
22 |
+} |
|
23 |
+ |
|
24 |
+function neutron_plugin_configure_dhcp_agent() { |
|
25 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport |
|
26 |
+} |
|
27 |
+ |
|
28 |
+function neutron_plugin_configure_l3_agent() { |
|
29 |
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge |
|
30 |
+ iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport |
|
31 |
+} |
|
32 |
+ |
|
33 |
+function neutron_plugin_configure_plugin_agent() { |
|
34 |
+ # Setup physical network interface mappings. Override |
|
35 |
+ # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more |
|
36 |
+ # complex physical network configurations. |
|
37 |
+ if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then |
|
38 |
+ LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE |
|
39 |
+ fi |
|
40 |
+ if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then |
|
41 |
+ iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS |
|
42 |
+ fi |
|
43 |
+ if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
44 |
+ iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver |
|
45 |
+ else |
|
46 |
+ iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver |
|
47 |
+ fi |
|
48 |
+ AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent" |
|
49 |
+ # Define extra "AGENT" configuration options when q-agt is configured by defining |
|
50 |
+ # the array ``Q_AGENT_EXTRA_AGENT_OPTS``. |
|
51 |
+ # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)`` |
|
52 |
+ for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do |
|
53 |
+ # Replace the first '=' with ' ' for iniset syntax |
|
54 |
+ iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ } |
|
55 |
+ done |
|
56 |
+ # Define extra "LINUX_BRIDGE" configuration options when q-agt is configured by defining |
|
57 |
+ # the array ``Q_AGENT_EXTRA_SRV_OPTS``. |
|
58 |
+ # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)`` |
|
59 |
+ for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do |
|
60 |
+ # Replace the first '=' with ' ' for iniset syntax |
|
61 |
+ iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ } |
|
62 |
+ done |
|
63 |
+} |
|
64 |
+ |
|
65 |
+function neutron_plugin_setup_interface_driver() { |
|
66 |
+ local conf_file=$1 |
|
67 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver |
|
68 |
+} |
|
69 |
+ |
|
70 |
+function neutron_plugin_check_adv_test_requirements() { |
|
71 |
+ is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
72 |
+} |
|
73 |
+ |
|
74 |
+# Restore xtrace |
|
75 |
+$PLUGIN_XTRACE |
0 | 76 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,62 @@ |
0 |
+# Neutron Modular Layer 2 plugin |
|
1 |
+# ------------------------------ |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+# Default openvswitch L2 agent |
|
8 |
+Q_AGENT=${Q_AGENT:-openvswitch} |
|
9 |
+source $TOP_DIR/lib/neutron_plugins/${Q_AGENT}_agent |
|
10 |
+ |
|
11 |
+function neutron_plugin_configure_common() { |
|
12 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ml2 |
|
13 |
+ Q_PLUGIN_CONF_FILENAME=ml2_conf.ini |
|
14 |
+ Q_DB_NAME="neutron_ml2" |
|
15 |
+ Q_PLUGIN_CLASS="neutron.plugins.ml2.plugin.Ml2Plugin" |
|
16 |
+} |
|
17 |
+ |
|
18 |
+function neutron_plugin_configure_service() { |
|
19 |
+ if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then |
|
20 |
+ iniset /$Q_PLUGIN_CONF_FILE ml2 tenant_network_types gre |
|
21 |
+ iniset /$Q_PLUGIN_CONF_FILE ml2_type_gre tunnel_id_ranges $TENANT_TUNNEL_RANGES |
|
22 |
+ elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
23 |
+ iniset /$Q_PLUGIN_CONF_FILE ml2 tenant_network_types vlan |
|
24 |
+ else |
|
25 |
+ echo "WARNING - The ml2 plugin is using local tenant networks, with no connectivity between hosts." |
|
26 |
+ fi |
|
27 |
+ |
|
28 |
+ # Override ``ML2_VLAN_RANGES`` and any needed agent configuration |
|
29 |
+ # variables in ``localrc`` for more complex physical network |
|
30 |
+ # configurations. |
|
31 |
+ if [[ "$ML2_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
32 |
+ ML2_VLAN_RANGES=$PHYSICAL_NETWORK |
|
33 |
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
34 |
+ ML2_VLAN_RANGES=$ML2_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
35 |
+ fi |
|
36 |
+ fi |
|
37 |
+ if [[ "$ML2_VLAN_RANGES" != "" ]]; then |
|
38 |
+ iniset /$Q_PLUGIN_CONF_FILE ml2_type_vlan network_vlan_ranges $ML2_VLAN_RANGES |
|
39 |
+ fi |
|
40 |
+ |
|
41 |
+ # REVISIT(rkukura): Setting firewall_driver here for |
|
42 |
+ # neutron.agent.securitygroups_rpc.is_firewall_enabled() which is |
|
43 |
+ # used in the server, in case no L2 agent is configured on the |
|
44 |
+ # server's node. If an L2 agent is configured, this will get |
|
45 |
+ # overridden with the correct driver. The ml2 plugin should |
|
46 |
+ # instead use its own config variable to indicate whether security |
|
47 |
+ # groups is enabled, and that will need to be set here instead. |
|
48 |
+ if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
49 |
+ iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver neutron.agent.not.a.real.FirewallDriver |
|
50 |
+ else |
|
51 |
+ iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver neutron.agent.firewall.NoopFirewallDriver |
|
52 |
+ fi |
|
53 |
+ |
|
54 |
+} |
|
55 |
+ |
|
56 |
+function has_neutron_plugin_security_group() { |
|
57 |
+ return 0 |
|
58 |
+} |
|
59 |
+ |
|
60 |
+# Restore xtrace |
|
61 |
+$MY_XTRACE |
0 | 62 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,126 @@ |
0 |
+# Neutron NEC OpenFlow plugin |
|
1 |
+# --------------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+# Configuration parameters |
|
8 |
+OFC_HOST=${OFC_HOST:-127.0.0.1} |
|
9 |
+OFC_PORT=${OFC_PORT:-8888} |
|
10 |
+ |
|
11 |
+OFC_API_HOST=${OFC_API_HOST:-$OFC_HOST} |
|
12 |
+OFC_API_PORT=${OFC_API_PORT:-$OFC_PORT} |
|
13 |
+OFC_OFP_HOST=${OFC_OFP_HOST:-$OFC_HOST} |
|
14 |
+OFC_OFP_PORT=${OFC_OFP_PORT:-6633} |
|
15 |
+OFC_DRIVER=${OFC_DRIVER:-trema} |
|
16 |
+OFC_RETRY_MAX=${OFC_RETRY_MAX:-0} |
|
17 |
+OFC_RETRY_INTERVAL=${OFC_RETRY_INTERVAL:-1} |
|
18 |
+ |
|
19 |
+# Main logic |
|
20 |
+# --------------------------- |
|
21 |
+ |
|
22 |
+source $TOP_DIR/lib/neutron_plugins/ovs_base |
|
23 |
+ |
|
24 |
+function neutron_plugin_create_nova_conf() { |
|
25 |
+ _neutron_ovs_base_configure_nova_vif_driver |
|
26 |
+} |
|
27 |
+ |
|
28 |
+function neutron_plugin_install_agent_packages() { |
|
29 |
+ # SKIP_OVS_INSTALL is useful when we want to use Open vSwitch whose |
|
30 |
+ # version is different from the version provided by the distribution. |
|
31 |
+ if [[ "$SKIP_OVS_INSTALL" = "True" ]]; then |
|
32 |
+ echo "You need to install Open vSwitch manually." |
|
33 |
+ return |
|
34 |
+ fi |
|
35 |
+ _neutron_ovs_base_install_agent_packages |
|
36 |
+} |
|
37 |
+ |
|
38 |
+function neutron_plugin_configure_common() { |
|
39 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/nec |
|
40 |
+ Q_PLUGIN_CONF_FILENAME=nec.ini |
|
41 |
+ Q_DB_NAME="neutron_nec" |
|
42 |
+ Q_PLUGIN_CLASS="neutron.plugins.nec.nec_plugin.NECPluginV2" |
|
43 |
+} |
|
44 |
+ |
|
45 |
+function neutron_plugin_configure_debug_command() { |
|
46 |
+ _neutron_ovs_base_configure_debug_command |
|
47 |
+} |
|
48 |
+ |
|
49 |
+function neutron_plugin_configure_dhcp_agent() { |
|
50 |
+ : |
|
51 |
+} |
|
52 |
+ |
|
53 |
+function neutron_plugin_configure_l3_agent() { |
|
54 |
+ _neutron_ovs_base_configure_l3_agent |
|
55 |
+} |
|
56 |
+ |
|
57 |
+function neutron_plugin_configure_plugin_agent() { |
|
58 |
+ if [[ "$SKIP_OVS_BRIDGE_SETUP" = "True" ]]; then |
|
59 |
+ return |
|
60 |
+ fi |
|
61 |
+ # Set up integration bridge |
|
62 |
+ _neutron_ovs_base_setup_bridge $OVS_BRIDGE |
|
63 |
+ sudo ovs-vsctl --no-wait set-controller $OVS_BRIDGE tcp:$OFC_OFP_HOST:$OFC_OFP_PORT |
|
64 |
+ # Generate datapath ID from HOST_IP |
|
65 |
+ local dpid=$(printf "0x%07d%03d%03d%03d\n" ${HOST_IP//./ }) |
|
66 |
+ sudo ovs-vsctl --no-wait set Bridge $OVS_BRIDGE other-config:datapath-id=$dpid |
|
67 |
+ sudo ovs-vsctl --no-wait set-fail-mode $OVS_BRIDGE secure |
|
68 |
+ if [ -n "$OVS_INTERFACE" ]; then |
|
69 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $OVS_INTERFACE |
|
70 |
+ fi |
|
71 |
+ _neutron_setup_ovs_tunnels $OVS_BRIDGE |
|
72 |
+ AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-nec-agent" |
|
73 |
+ |
|
74 |
+ _neutron_ovs_base_configure_firewall_driver |
|
75 |
+} |
|
76 |
+ |
|
77 |
+function neutron_plugin_configure_service() { |
|
78 |
+ iniset $NEUTRON_CONF DEFAULT api_extensions_path neutron/plugins/nec/extensions/ |
|
79 |
+ iniset /$Q_PLUGIN_CONF_FILE ofc host $OFC_API_HOST |
|
80 |
+ iniset /$Q_PLUGIN_CONF_FILE ofc port $OFC_API_PORT |
|
81 |
+ iniset /$Q_PLUGIN_CONF_FILE ofc driver $OFC_DRIVER |
|
82 |
+ iniset /$Q_PLUGIN_CONF_FILE ofc api_retry_max OFC_RETRY_MAX |
|
83 |
+ iniset /$Q_PLUGIN_CONF_FILE ofc api_retry_interval OFC_RETRY_INTERVAL |
|
84 |
+ |
|
85 |
+ _neutron_ovs_base_configure_firewall_driver |
|
86 |
+} |
|
87 |
+ |
|
88 |
+function neutron_plugin_setup_interface_driver() { |
|
89 |
+ local conf_file=$1 |
|
90 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
|
91 |
+ iniset $conf_file DEFAULT ovs_use_veth True |
|
92 |
+} |
|
93 |
+ |
|
94 |
+# Utility functions |
|
95 |
+# --------------------------- |
|
96 |
+ |
|
97 |
+# Setup OVS tunnel manually |
|
98 |
+function _neutron_setup_ovs_tunnels() { |
|
99 |
+ local bridge=$1 |
|
100 |
+ local id=0 |
|
101 |
+ GRE_LOCAL_IP=${GRE_LOCAL_IP:-$HOST_IP} |
|
102 |
+ if [ -n "$GRE_REMOTE_IPS" ]; then |
|
103 |
+ for ip in ${GRE_REMOTE_IPS//:/ } |
|
104 |
+ do |
|
105 |
+ if [[ "$ip" == "$GRE_LOCAL_IP" ]]; then |
|
106 |
+ continue |
|
107 |
+ fi |
|
108 |
+ sudo ovs-vsctl --no-wait add-port $bridge gre$id -- \ |
|
109 |
+ set Interface gre$id type=gre options:remote_ip=$ip |
|
110 |
+ id=`expr $id + 1` |
|
111 |
+ done |
|
112 |
+ fi |
|
113 |
+} |
|
114 |
+ |
|
115 |
+function has_neutron_plugin_security_group() { |
|
116 |
+ # 0 means True here |
|
117 |
+ return 0 |
|
118 |
+} |
|
119 |
+ |
|
120 |
+function neutron_plugin_check_adv_test_requirements() { |
|
121 |
+ is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
122 |
+} |
|
123 |
+ |
|
124 |
+# Restore xtrace |
|
125 |
+$MY_XTRACE |
0 | 126 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,138 @@ |
0 |
+# Neutron Nicira NVP 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 setup_integration_bridge() { |
|
10 |
+ _neutron_ovs_base_setup_bridge $OVS_BRIDGE |
|
11 |
+ # Set manager to NVP controller (1st of list) |
|
12 |
+ if [[ "$NVP_CONTROLLERS" != "" ]]; then |
|
13 |
+ # Get the first controller |
|
14 |
+ controllers=(${NVP_CONTROLLERS//,/ }) |
|
15 |
+ OVS_MGR_IP=${controllers[0]} |
|
16 |
+ else |
|
17 |
+ die $LINENO "Error - No controller specified. Unable to set a manager for OVS" |
|
18 |
+ fi |
|
19 |
+ sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP |
|
20 |
+} |
|
21 |
+ |
|
22 |
+function is_neutron_ovs_base_plugin() { |
|
23 |
+ # NVP uses OVS, but not the l3-agent |
|
24 |
+ return 0 |
|
25 |
+} |
|
26 |
+ |
|
27 |
+function neutron_plugin_create_nova_conf() { |
|
28 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"} |
|
29 |
+ # if n-cpu is enabled, then setup integration bridge |
|
30 |
+ if is_service_enabled n-cpu; then |
|
31 |
+ setup_integration_bridge |
|
32 |
+ fi |
|
33 |
+} |
|
34 |
+ |
|
35 |
+function neutron_plugin_install_agent_packages() { |
|
36 |
+ # Nicira Plugin does not run q-agt, but it currently needs dhcp and metadata agents |
|
37 |
+ _neutron_ovs_base_install_agent_packages |
|
38 |
+} |
|
39 |
+ |
|
40 |
+function neutron_plugin_configure_common() { |
|
41 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/nicira |
|
42 |
+ Q_PLUGIN_CONF_FILENAME=nvp.ini |
|
43 |
+ Q_DB_NAME="neutron_nvp" |
|
44 |
+ Q_PLUGIN_CLASS="neutron.plugins.nicira.nicira_nvp_plugin.NeutronPlugin.NvpPluginV2" |
|
45 |
+} |
|
46 |
+ |
|
47 |
+function neutron_plugin_configure_debug_command() { |
|
48 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
|
49 |
+} |
|
50 |
+ |
|
51 |
+function neutron_plugin_configure_dhcp_agent() { |
|
52 |
+ setup_integration_bridge |
|
53 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True |
|
54 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True |
|
55 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True |
|
56 |
+} |
|
57 |
+ |
|
58 |
+function neutron_plugin_configure_l3_agent() { |
|
59 |
+ # Nicira plugin does not run L3 agent |
|
60 |
+ die $LINENO "q-l3 should must not be executed with Nicira plugin!" |
|
61 |
+} |
|
62 |
+ |
|
63 |
+function neutron_plugin_configure_plugin_agent() { |
|
64 |
+ # Nicira plugin does not run L2 agent |
|
65 |
+ die $LINENO "q-agt must not be executed with Nicira plugin!" |
|
66 |
+} |
|
67 |
+ |
|
68 |
+function neutron_plugin_configure_service() { |
|
69 |
+ if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then |
|
70 |
+ iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS |
|
71 |
+ fi |
|
72 |
+ if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then |
|
73 |
+ iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS |
|
74 |
+ fi |
|
75 |
+ if [[ "$FAILOVER_TIME" != "" ]]; then |
|
76 |
+ iniset /$Q_PLUGIN_CONF_FILE nvp failover_time $FAILOVER_TIME |
|
77 |
+ fi |
|
78 |
+ if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then |
|
79 |
+ iniset /$Q_PLUGIN_CONF_FILE nvp concurrent_connections $CONCURRENT_CONNECTIONS |
|
80 |
+ fi |
|
81 |
+ |
|
82 |
+ if [[ "$DEFAULT_TZ_UUID" != "" ]]; then |
|
83 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_tz_uuid $DEFAULT_TZ_UUID |
|
84 |
+ else |
|
85 |
+ die $LINENO "The nicira plugin won't work without a default transport zone." |
|
86 |
+ fi |
|
87 |
+ if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then |
|
88 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID |
|
89 |
+ Q_L3_ENABLED=True |
|
90 |
+ Q_L3_ROUTER_PER_TENANT=True |
|
91 |
+ iniset /$Q_PLUGIN_CONF_FILE nvp enable_metadata_access_network True |
|
92 |
+ fi |
|
93 |
+ if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then |
|
94 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID |
|
95 |
+ fi |
|
96 |
+ # NVP_CONTROLLERS must be a comma separated string |
|
97 |
+ if [[ "$NVP_CONTROLLERS" != "" ]]; then |
|
98 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_controllers $NVP_CONTROLLERS |
|
99 |
+ else |
|
100 |
+ die $LINENO "The nicira plugin needs at least an NVP controller." |
|
101 |
+ fi |
|
102 |
+ if [[ "$NVP_USER" != "" ]]; then |
|
103 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_user $NVP_USER |
|
104 |
+ fi |
|
105 |
+ if [[ "$NVP_PASSWORD" != "" ]]; then |
|
106 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_password $NVP_PASSWORD |
|
107 |
+ fi |
|
108 |
+ if [[ "$NVP_REQ_TIMEOUT" != "" ]]; then |
|
109 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT req_timeout $NVP_REQ_TIMEOUT |
|
110 |
+ fi |
|
111 |
+ if [[ "$NVP_HTTP_TIMEOUT" != "" ]]; then |
|
112 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT http_timeout $NVP_HTTP_TIMEOUT |
|
113 |
+ fi |
|
114 |
+ if [[ "$NVP_RETRIES" != "" ]]; then |
|
115 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT retries $NVP_RETRIES |
|
116 |
+ fi |
|
117 |
+ if [[ "$NVP_REDIRECTS" != "" ]]; then |
|
118 |
+ iniset /$Q_PLUGIN_CONF_FILE DEFAULT redirects $NVP_REDIRECTS |
|
119 |
+ fi |
|
120 |
+} |
|
121 |
+ |
|
122 |
+function neutron_plugin_setup_interface_driver() { |
|
123 |
+ local conf_file=$1 |
|
124 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
|
125 |
+} |
|
126 |
+ |
|
127 |
+function has_neutron_plugin_security_group() { |
|
128 |
+ # 0 means True here |
|
129 |
+ return 0 |
|
130 |
+} |
|
131 |
+ |
|
132 |
+function neutron_plugin_check_adv_test_requirements() { |
|
133 |
+ is_service_enabled q-dhcp && return 0 |
|
134 |
+} |
|
135 |
+ |
|
136 |
+# Restore xtrace |
|
137 |
+$MY_XTRACE |
0 | 138 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,60 @@ |
0 |
+# Neutron Open vSwitch 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/openvswitch_agent |
|
8 |
+ |
|
9 |
+function neutron_plugin_configure_common() { |
|
10 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/openvswitch |
|
11 |
+ Q_PLUGIN_CONF_FILENAME=ovs_neutron_plugin.ini |
|
12 |
+ Q_DB_NAME="ovs_neutron" |
|
13 |
+ Q_PLUGIN_CLASS="neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2" |
|
14 |
+} |
|
15 |
+ |
|
16 |
+function neutron_plugin_configure_service() { |
|
17 |
+ if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then |
|
18 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type gre |
|
19 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs tunnel_id_ranges $TENANT_TUNNEL_RANGES |
|
20 |
+ elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
21 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type vlan |
|
22 |
+ else |
|
23 |
+ echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts." |
|
24 |
+ fi |
|
25 |
+ |
|
26 |
+ # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` |
|
27 |
+ # for more complex physical network configurations. |
|
28 |
+ if [[ "$OVS_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
29 |
+ OVS_VLAN_RANGES=$PHYSICAL_NETWORK |
|
30 |
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
31 |
+ OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
32 |
+ fi |
|
33 |
+ fi |
|
34 |
+ if [[ "$OVS_VLAN_RANGES" != "" ]]; then |
|
35 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs network_vlan_ranges $OVS_VLAN_RANGES |
|
36 |
+ fi |
|
37 |
+ |
|
38 |
+ # Enable tunnel networks if selected |
|
39 |
+ if [[ $OVS_ENABLE_TUNNELING = "True" ]]; then |
|
40 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs enable_tunneling True |
|
41 |
+ fi |
|
42 |
+ |
|
43 |
+ _neutron_ovs_base_configure_firewall_driver |
|
44 |
+ |
|
45 |
+ # Define extra "OVS" configuration options when q-svc is configured by defining |
|
46 |
+ # the array ``Q_SRV_EXTRA_OPTS``. |
|
47 |
+ # For Example: ``Q_SRV_EXTRA_OPTS=(foo=true bar=2)`` |
|
48 |
+ for I in "${Q_SRV_EXTRA_OPTS[@]}"; do |
|
49 |
+ # Replace the first '=' with ' ' for iniset syntax |
|
50 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs ${I/=/ } |
|
51 |
+ done |
|
52 |
+} |
|
53 |
+ |
|
54 |
+function has_neutron_plugin_security_group() { |
|
55 |
+ return 0 |
|
56 |
+} |
|
57 |
+ |
|
58 |
+# Restore xtrace |
|
59 |
+$MY_XTRACE |
0 | 60 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,131 @@ |
0 |
+# Neutron Open vSwitch L2 agent |
|
1 |
+# ----------------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+PLUGIN_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+source $TOP_DIR/lib/neutron_plugins/ovs_base |
|
8 |
+ |
|
9 |
+function neutron_plugin_create_nova_conf() { |
|
10 |
+ _neutron_ovs_base_configure_nova_vif_driver |
|
11 |
+ if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
12 |
+ iniset $NOVA_CONF DEFAULT xenapi_vif_driver nova.virt.xenapi.vif.XenAPIOpenVswitchDriver |
|
13 |
+ iniset $NOVA_CONF DEFAULT xenapi_ovs_integration_bridge $XEN_INTEGRATION_BRIDGE |
|
14 |
+ # Disable nova's firewall so that it does not conflict with neutron |
|
15 |
+ iniset $NOVA_CONF DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver |
|
16 |
+ fi |
|
17 |
+} |
|
18 |
+ |
|
19 |
+function neutron_plugin_install_agent_packages() { |
|
20 |
+ _neutron_ovs_base_install_agent_packages |
|
21 |
+} |
|
22 |
+ |
|
23 |
+function neutron_plugin_configure_debug_command() { |
|
24 |
+ _neutron_ovs_base_configure_debug_command |
|
25 |
+} |
|
26 |
+ |
|
27 |
+function neutron_plugin_configure_dhcp_agent() { |
|
28 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport |
|
29 |
+} |
|
30 |
+ |
|
31 |
+function neutron_plugin_configure_l3_agent() { |
|
32 |
+ _neutron_ovs_base_configure_l3_agent |
|
33 |
+ iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport |
|
34 |
+} |
|
35 |
+ |
|
36 |
+function neutron_plugin_configure_plugin_agent() { |
|
37 |
+ # Setup integration bridge |
|
38 |
+ _neutron_ovs_base_setup_bridge $OVS_BRIDGE |
|
39 |
+ _neutron_ovs_base_configure_firewall_driver |
|
40 |
+ |
|
41 |
+ # Setup agent for tunneling |
|
42 |
+ if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then |
|
43 |
+ # Verify tunnels are supported |
|
44 |
+ # REVISIT - also check kernel module support for GRE and patch ports |
|
45 |
+ OVS_VERSION=`ovs-vsctl --version | head -n 1 | grep -E -o "[0-9]+\.[0-9]+"` |
|
46 |
+ if [ `vercmp_numbers "$OVS_VERSION" "1.4"` -lt "0" ] && ! is_service_enabled q-svc ; then |
|
47 |
+ die $LINENO "You are running OVS version $OVS_VERSION. OVS 1.4+ is required for tunneling between multiple hosts." |
|
48 |
+ fi |
|
49 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs enable_tunneling True |
|
50 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs local_ip $HOST_IP |
|
51 |
+ fi |
|
52 |
+ |
|
53 |
+ # Setup physical network bridge mappings. Override |
|
54 |
+ # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more |
|
55 |
+ # complex physical network configurations. |
|
56 |
+ if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then |
|
57 |
+ OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE |
|
58 |
+ |
|
59 |
+ # Configure bridge manually with physical interface as port for multi-node |
|
60 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE |
|
61 |
+ fi |
|
62 |
+ if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then |
|
63 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings $OVS_BRIDGE_MAPPINGS |
|
64 |
+ fi |
|
65 |
+ AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-openvswitch-agent" |
|
66 |
+ |
|
67 |
+ if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
68 |
+ # Make a copy of our config for domU |
|
69 |
+ sudo cp /$Q_PLUGIN_CONF_FILE "/$Q_PLUGIN_CONF_FILE.domu" |
|
70 |
+ |
|
71 |
+ # Deal with Dom0's L2 Agent: |
|
72 |
+ Q_RR_DOM0_COMMAND="$NEUTRON_BIN_DIR/neutron-rootwrap-xen-dom0 $Q_RR_CONF_FILE" |
|
73 |
+ |
|
74 |
+ # For now, duplicate the xen configuration already found in nova.conf |
|
75 |
+ iniset $Q_RR_CONF_FILE xenapi xenapi_connection_url "$XENAPI_CONNECTION_URL" |
|
76 |
+ iniset $Q_RR_CONF_FILE xenapi xenapi_connection_username "$XENAPI_USER" |
|
77 |
+ iniset $Q_RR_CONF_FILE xenapi xenapi_connection_password "$XENAPI_PASSWORD" |
|
78 |
+ |
|
79 |
+ # Under XS/XCP, the ovs agent needs to target the dom0 |
|
80 |
+ # integration bridge. This is enabled by using a root wrapper |
|
81 |
+ # that executes commands on dom0 via a XenAPI plugin. |
|
82 |
+ iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_DOM0_COMMAND" |
|
83 |
+ |
|
84 |
+ # Set "physical" mapping |
|
85 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings "physnet1:$FLAT_NETWORK_BRIDGE" |
|
86 |
+ |
|
87 |
+ # XEN_INTEGRATION_BRIDGE is the integration bridge in dom0 |
|
88 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs integration_bridge $XEN_INTEGRATION_BRIDGE |
|
89 |
+ |
|
90 |
+ # Set up domU's L2 agent: |
|
91 |
+ |
|
92 |
+ # Create a bridge "br-$GUEST_INTERFACE_DEFAULT" |
|
93 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br "br-$GUEST_INTERFACE_DEFAULT" |
|
94 |
+ # Add $GUEST_INTERFACE_DEFAULT to that bridge |
|
95 |
+ sudo ovs-vsctl add-port "br-$GUEST_INTERFACE_DEFAULT" $GUEST_INTERFACE_DEFAULT |
|
96 |
+ |
|
97 |
+ # Set bridge mappings to "physnet1:br-$GUEST_INTERFACE_DEFAULT" |
|
98 |
+ iniset "/$Q_PLUGIN_CONF_FILE.domU" ovs bridge_mappings "physnet1:br-$GUEST_INTERFACE_DEFAULT" |
|
99 |
+ # Set integration bridge to domU's |
|
100 |
+ iniset "/$Q_PLUGIN_CONF_FILE.domU" ovs integration_bridge $OVS_BRIDGE |
|
101 |
+ # Set root wrap |
|
102 |
+ iniset "/$Q_PLUGIN_CONF_FILE.domU" agent root_helper "$Q_RR_COMMAND" |
|
103 |
+ fi |
|
104 |
+ # Define extra "AGENT" configuration options when q-agt is configured by defining |
|
105 |
+ # defining the array ``Q_AGENT_EXTRA_AGENT_OPTS``. |
|
106 |
+ # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)`` |
|
107 |
+ for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do |
|
108 |
+ # Replace the first '=' with ' ' for iniset syntax |
|
109 |
+ iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ } |
|
110 |
+ done |
|
111 |
+ # Define extra "OVS" configuration options when q-agt is configured by defining |
|
112 |
+ # defining the array ``Q_AGENT_EXTRA_SRV_OPTS``. |
|
113 |
+ # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)`` |
|
114 |
+ for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do |
|
115 |
+ # Replace the first '=' with ' ' for iniset syntax |
|
116 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs ${I/=/ } |
|
117 |
+ done |
|
118 |
+} |
|
119 |
+ |
|
120 |
+function neutron_plugin_setup_interface_driver() { |
|
121 |
+ local conf_file=$1 |
|
122 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
|
123 |
+} |
|
124 |
+ |
|
125 |
+function neutron_plugin_check_adv_test_requirements() { |
|
126 |
+ is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
127 |
+} |
|
128 |
+ |
|
129 |
+# Restore xtrace |
|
130 |
+$PLUGIN_XTRACE |
0 | 131 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,85 @@ |
0 |
+# common functions for ovs based plugin |
|
1 |
+# ------------------------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
8 |
+PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex} |
|
9 |
+ |
|
10 |
+function is_neutron_ovs_base_plugin() { |
|
11 |
+ # Yes, we use OVS. |
|
12 |
+ return 0 |
|
13 |
+} |
|
14 |
+ |
|
15 |
+function _neutron_ovs_base_setup_bridge() { |
|
16 |
+ local bridge=$1 |
|
17 |
+ neutron-ovs-cleanup |
|
18 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
|
19 |
+ sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
|
20 |
+} |
|
21 |
+ |
|
22 |
+function neutron_ovs_base_cleanup() { |
|
23 |
+ # remove all OVS ports that look like Neutron created ports |
|
24 |
+ for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do |
|
25 |
+ sudo ovs-vsctl del-port ${port} |
|
26 |
+ done |
|
27 |
+ |
|
28 |
+ # remove all OVS bridges created by Neutron |
|
29 |
+ for bridge in $(sudo ovs-vsctl list-br | grep -o -e ${OVS_BRIDGE} -e ${PUBLIC_BRIDGE}); do |
|
30 |
+ sudo ovs-vsctl del-br ${bridge} |
|
31 |
+ done |
|
32 |
+} |
|
33 |
+ |
|
34 |
+function _neutron_ovs_base_install_agent_packages() { |
|
35 |
+ local kernel_version |
|
36 |
+ # Install deps |
|
37 |
+ # FIXME add to ``files/apts/neutron``, but don't install if not needed! |
|
38 |
+ if is_ubuntu; then |
|
39 |
+ kernel_version=`cat /proc/version | cut -d " " -f3` |
|
40 |
+ install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
|
41 |
+ elif is_fedora; then |
|
42 |
+ install_package openvswitch |
|
43 |
+ # Ensure that the service is started |
|
44 |
+ restart_service openvswitch |
|
45 |
+ elif is_suse; then |
|
46 |
+ ### FIXME: Find out if package can be pushed to Factory |
|
47 |
+ echo "OpenVSwitch packages can be installed from Cloud:OpenStack:Master in OBS" |
|
48 |
+ restart_service openvswitch |
|
49 |
+ fi |
|
50 |
+} |
|
51 |
+ |
|
52 |
+function _neutron_ovs_base_configure_debug_command() { |
|
53 |
+ iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
54 |
+} |
|
55 |
+ |
|
56 |
+function _neutron_ovs_base_configure_firewall_driver() { |
|
57 |
+ if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
58 |
+ iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver |
|
59 |
+ else |
|
60 |
+ iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver |
|
61 |
+ fi |
|
62 |
+} |
|
63 |
+ |
|
64 |
+function _neutron_ovs_base_configure_l3_agent() { |
|
65 |
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
66 |
+ |
|
67 |
+ neutron-ovs-cleanup |
|
68 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
|
69 |
+ # ensure no IP is configured on the public bridge |
|
70 |
+ sudo ip addr flush dev $PUBLIC_BRIDGE |
|
71 |
+} |
|
72 |
+ |
|
73 |
+function _neutron_ovs_base_configure_nova_vif_driver() { |
|
74 |
+ # The hybrid VIF driver needs to be specified when Neutron Security Group |
|
75 |
+ # is enabled (until vif_security attributes are supported in VIF extension) |
|
76 |
+ if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
77 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"} |
|
78 |
+ else |
|
79 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
80 |
+ fi |
|
81 |
+} |
|
82 |
+ |
|
83 |
+# Restore xtrace |
|
84 |
+$MY_XTRACE |
0 | 85 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,42 @@ |
0 |
+# PLUMgrid Neutron Plugin |
|
1 |
+# Edgar Magana emagana@plumgrid.com |
|
2 |
+# ------------------------------------ |
|
3 |
+ |
|
4 |
+# Save trace settings |
|
5 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
+set +o xtrace |
|
7 |
+ |
|
8 |
+#source $TOP_DIR/lib/neutron_plugins/ovs_base |
|
9 |
+ |
|
10 |
+function neutron_plugin_create_nova_conf() { |
|
11 |
+ |
|
12 |
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
13 |
+} |
|
14 |
+ |
|
15 |
+function neutron_plugin_setup_interface_driver() { |
|
16 |
+ : |
|
17 |
+} |
|
18 |
+ |
|
19 |
+function neutron_plugin_configure_common() { |
|
20 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/plumgrid |
|
21 |
+ Q_PLUGIN_CONF_FILENAME=plumgrid.ini |
|
22 |
+ Q_DB_NAME="plumgrid_neutron" |
|
23 |
+ Q_PLUGIN_CLASS="neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2" |
|
24 |
+} |
|
25 |
+ |
|
26 |
+function neutron_plugin_configure_service() { |
|
27 |
+ PLUMGRID_NOS_IP=${PLUMGRID_NOS_IP:-localhost} |
|
28 |
+ PLUMGRID_NOS_PORT=${PLUMGRID_NOS_PORT:-7766} |
|
29 |
+ iniset /$Q_PLUGIN_CONF_FILE plumgridnos nos_server $PLUMGRID_NOS_IP |
|
30 |
+ iniset /$Q_PLUGIN_CONF_FILE plumgridnos nos_server_port $PLUMGRID_NOS_PORT |
|
31 |
+} |
|
32 |
+ |
|
33 |
+function neutron_plugin_configure_debug_command() { |
|
34 |
+ : |
|
35 |
+} |
|
36 |
+ |
|
37 |
+function neutron_plugin_check_adv_test_requirements() { |
|
38 |
+ is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
39 |
+} |
|
40 |
+# Restore xtrace |
|
41 |
+$MY_XTRACE |
0 | 42 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,80 @@ |
0 |
+# Neutron Ryu 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 |
+source $TOP_DIR/lib/neutron_thirdparty/ryu # for configuration value |
|
9 |
+ |
|
10 |
+function neutron_plugin_create_nova_conf() { |
|
11 |
+ _neutron_ovs_base_configure_nova_vif_driver |
|
12 |
+ iniset $NOVA_CONF DEFAULT libvirt_ovs_integration_bridge "$OVS_BRIDGE" |
|
13 |
+} |
|
14 |
+ |
|
15 |
+function neutron_plugin_install_agent_packages() { |
|
16 |
+ _neutron_ovs_base_install_agent_packages |
|
17 |
+ |
|
18 |
+ # neutron_ryu_agent requires ryu module |
|
19 |
+ install_package $(get_packages "ryu") |
|
20 |
+ install_ryu |
|
21 |
+ configure_ryu |
|
22 |
+} |
|
23 |
+ |
|
24 |
+function neutron_plugin_configure_common() { |
|
25 |
+ Q_PLUGIN_CONF_PATH=etc/neutron/plugins/ryu |
|
26 |
+ Q_PLUGIN_CONF_FILENAME=ryu.ini |
|
27 |
+ Q_DB_NAME="ovs_neutron" |
|
28 |
+ Q_PLUGIN_CLASS="neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2" |
|
29 |
+} |
|
30 |
+ |
|
31 |
+function neutron_plugin_configure_debug_command() { |
|
32 |
+ _neutron_ovs_base_configure_debug_command |
|
33 |
+ iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
34 |
+} |
|
35 |
+ |
|
36 |
+function neutron_plugin_configure_dhcp_agent() { |
|
37 |
+ iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
38 |
+} |
|
39 |
+ |
|
40 |
+function neutron_plugin_configure_l3_agent() { |
|
41 |
+ iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
42 |
+ _neutron_ovs_base_configure_l3_agent |
|
43 |
+} |
|
44 |
+ |
|
45 |
+function neutron_plugin_configure_plugin_agent() { |
|
46 |
+ # Set up integration bridge |
|
47 |
+ _neutron_ovs_base_setup_bridge $OVS_BRIDGE |
|
48 |
+ if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
|
49 |
+ sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
|
50 |
+ fi |
|
51 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs integration_bridge $OVS_BRIDGE |
|
52 |
+ AGENT_BINARY="$NEUTRON_DIR/neutron/plugins/ryu/agent/ryu_neutron_agent.py" |
|
53 |
+ |
|
54 |
+ _neutron_ovs_base_configure_firewall_driver |
|
55 |
+} |
|
56 |
+ |
|
57 |
+function neutron_plugin_configure_service() { |
|
58 |
+ iniset /$Q_PLUGIN_CONF_FILE ovs openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
|
59 |
+ |
|
60 |
+ _neutron_ovs_base_configure_firewall_driver |
|
61 |
+} |
|
62 |
+ |
|
63 |
+function neutron_plugin_setup_interface_driver() { |
|
64 |
+ local conf_file=$1 |
|
65 |
+ iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
|
66 |
+ iniset $conf_file DEFAULT ovs_use_veth True |
|
67 |
+} |
|
68 |
+ |
|
69 |
+function has_neutron_plugin_security_group() { |
|
70 |
+ # 0 means True here |
|
71 |
+ return 0 |
|
72 |
+} |
|
73 |
+ |
|
74 |
+function neutron_plugin_check_adv_test_requirements() { |
|
75 |
+ is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
76 |
+} |
|
77 |
+ |
|
78 |
+# Restore xtrace |
|
79 |
+$MY_XTRACE |
0 | 80 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,50 @@ |
0 |
+# Neutron loadbalancer plugin |
|
1 |
+# --------------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+ |
|
8 |
+AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent" |
|
9 |
+LBAAS_PLUGIN=neutron.services.loadbalancer.plugin.LoadBalancerPlugin |
|
10 |
+ |
|
11 |
+function neutron_agent_lbaas_install_agent_packages() { |
|
12 |
+ if is_ubuntu || is_fedora; then |
|
13 |
+ install_package haproxy |
|
14 |
+ elif is_suse; then |
|
15 |
+ ### FIXME: Find out if package can be pushed to Factory |
|
16 |
+ echo "HAProxy packages can be installed from server:http project in OBS" |
|
17 |
+ fi |
|
18 |
+} |
|
19 |
+ |
|
20 |
+function neutron_agent_lbaas_configure_common() { |
|
21 |
+ if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then |
|
22 |
+ Q_SERVICE_PLUGIN_CLASSES=$LBAAS_PLUGIN |
|
23 |
+ else |
|
24 |
+ Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$LBAAS_PLUGIN" |
|
25 |
+ fi |
|
26 |
+} |
|
27 |
+ |
|
28 |
+function neutron_agent_lbaas_configure_agent() { |
|
29 |
+ LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy |
|
30 |
+ mkdir -p $LBAAS_AGENT_CONF_PATH |
|
31 |
+ |
|
32 |
+ LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini" |
|
33 |
+ |
|
34 |
+ cp $NEUTRON_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME |
|
35 |
+ |
|
36 |
+ iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
37 |
+ # ovs_use_veth needs to be set before the plugin configuration |
|
38 |
+ # occurs to allow plugins to override the setting. |
|
39 |
+ iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH |
|
40 |
+ |
|
41 |
+ neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME |
|
42 |
+ |
|
43 |
+ if is_fedora; then |
|
44 |
+ iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody" |
|
45 |
+ fi |
|
46 |
+} |
|
47 |
+ |
|
48 |
+# Restore xtrace |
|
49 |
+$MY_XTRACE |
0 | 50 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,36 @@ |
0 |
+Neutron third party specific files |
|
1 |
+================================== |
|
2 |
+Some Neutron plugins require third party programs to function. |
|
3 |
+The files under the directory, ``lib/neutron_thirdparty/``, will be used |
|
4 |
+when their service are enabled. |
|
5 |
+Third party program specific configuration variables should be in this file. |
|
6 |
+ |
|
7 |
+* filename: ``<third_party>`` |
|
8 |
+ * The corresponding file name should be same to service name, ``<third_party>``. |
|
9 |
+ |
|
10 |
+functions |
|
11 |
+--------- |
|
12 |
+``lib/neutron`` calls the following functions when the ``<third_party>`` is enabled |
|
13 |
+ |
|
14 |
+functions to be implemented |
|
15 |
+* ``configure_<third_party>``: |
|
16 |
+ set config files, create data dirs, etc |
|
17 |
+ e.g. |
|
18 |
+ sudo python setup.py deploy |
|
19 |
+ iniset $XXXX_CONF... |
|
20 |
+ |
|
21 |
+* ``init_<third_party>``: |
|
22 |
+ initialize databases, etc |
|
23 |
+ |
|
24 |
+* ``install_<third_party>``: |
|
25 |
+ collect source and prepare |
|
26 |
+ e.g. |
|
27 |
+ git clone xxx |
|
28 |
+ |
|
29 |
+* ``start_<third_party>``: |
|
30 |
+ start running processes, including screen |
|
31 |
+ e.g. |
|
32 |
+ screen_it XXXX "cd $XXXXY_DIR && $XXXX_DIR/bin/XXXX-bin" |
|
33 |
+ |
|
34 |
+* ``stop_<third_party>``: |
|
35 |
+ stop running processes (non-screen) |
0 | 36 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,49 @@ |
0 |
+# Big Switch/FloodLight OpenFlow Controller |
|
1 |
+# ------------------------------------------ |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80} |
|
8 |
+BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633} |
|
9 |
+ |
|
10 |
+function configure_bigswitch_floodlight() { |
|
11 |
+ : |
|
12 |
+} |
|
13 |
+ |
|
14 |
+function init_bigswitch_floodlight() { |
|
15 |
+ install_neutron_agent_packages |
|
16 |
+ |
|
17 |
+ echo -n "Installing OVS managed by the openflow controllers:" |
|
18 |
+ echo ${BS_FL_CONTROLLERS_PORT} |
|
19 |
+ |
|
20 |
+ # Create local OVS bridge and configure it |
|
21 |
+ sudo ovs-vsctl --no-wait -- --if-exists del-br ${OVS_BRIDGE} |
|
22 |
+ sudo ovs-vsctl --no-wait add-br ${OVS_BRIDGE} |
|
23 |
+ sudo ovs-vsctl --no-wait br-set-external-id ${OVS_BRIDGE} bridge-id ${OVS_BRIDGE} |
|
24 |
+ |
|
25 |
+ ctrls= |
|
26 |
+ for ctrl in `echo ${BS_FL_CONTROLLERS_PORT} | tr ',' ' '` |
|
27 |
+ do |
|
28 |
+ ctrl=${ctrl%:*} |
|
29 |
+ ctrls="${ctrls} tcp:${ctrl}:${BS_FL_OF_PORT}" |
|
30 |
+ done |
|
31 |
+ echo "Adding Network conttrollers: " ${ctrls} |
|
32 |
+ sudo ovs-vsctl --no-wait set-controller ${OVS_BRIDGE} ${ctrls} |
|
33 |
+} |
|
34 |
+ |
|
35 |
+function install_bigswitch_floodlight() { |
|
36 |
+ : |
|
37 |
+} |
|
38 |
+ |
|
39 |
+function start_bigswitch_floodlight() { |
|
40 |
+ : |
|
41 |
+} |
|
42 |
+ |
|
43 |
+function stop_bigswitch_floodlight() { |
|
44 |
+ : |
|
45 |
+} |
|
46 |
+ |
|
47 |
+# Restore xtrace |
|
48 |
+$MY_XTRACE |
0 | 49 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,52 @@ |
0 |
+# Nicira NVP |
|
1 |
+# ---------- |
|
2 |
+ |
|
3 |
+# This third-party addition can be used to configure connectivity between a DevStack instance |
|
4 |
+# and an NVP Gateway in dev/test environments. In order to use this correctly, the following |
|
5 |
+# env variables need to be set (e.g. in your localrc file): |
|
6 |
+# |
|
7 |
+# * enable_service nicira --> to execute this third-party addition |
|
8 |
+# * PUBLIC_BRIDGE --> bridge used for external connectivity, typically br-ex |
|
9 |
+# * NVP_GATEWAY_NETWORK_INTERFACE --> interface used to communicate with the NVP Gateway |
|
10 |
+# * NVP_GATEWAY_NETWORK_CIDR --> CIDR to configure br-ex, e.g. 172.24.4.211/24 |
|
11 |
+ |
|
12 |
+# Save trace setting |
|
13 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
14 |
+set +o xtrace |
|
15 |
+ |
|
16 |
+# This is the interface that connects the Devstack instance |
|
17 |
+# to an network that allows it to talk to the gateway for |
|
18 |
+# testing purposes |
|
19 |
+NVP_GATEWAY_NETWORK_INTERFACE=${NVP_GATEWAY_NETWORK_INTERFACE:-eth2} |
|
20 |
+ |
|
21 |
+function configure_nicira() { |
|
22 |
+ : |
|
23 |
+} |
|
24 |
+ |
|
25 |
+function init_nicira() { |
|
26 |
+ die_if_not_set $LINENO NVP_GATEWAY_NETWORK_CIDR "Please, specify CIDR for the gateway network interface." |
|
27 |
+ # Make sure the interface is up, but not configured |
|
28 |
+ sudo ifconfig $NVP_GATEWAY_NETWORK_INTERFACE up |
|
29 |
+ sudo ip addr flush $NVP_GATEWAY_NETWORK_INTERFACE |
|
30 |
+ # Use the PUBLIC Bridge to route traffic to the NVP gateway |
|
31 |
+ # NOTE(armando-migliaccio): if running in a nested environment this will work |
|
32 |
+ # only with mac learning enabled, portsecurity and security profiles disabled |
|
33 |
+ sudo ovs-vsctl -- --may-exist add-port $PUBLIC_BRIDGE $NVP_GATEWAY_NETWORK_INTERFACE |
|
34 |
+ nvp_gw_net_if_mac=$(ip link show $NVP_GATEWAY_NETWORK_INTERFACE | awk '/ether/ {print $2}') |
|
35 |
+ sudo ifconfig $PUBLIC_BRIDGE $NVP_GATEWAY_NETWORK_CIDR hw ether $nvp_gw_net_if_mac |
|
36 |
+} |
|
37 |
+ |
|
38 |
+function install_nicira() { |
|
39 |
+ : |
|
40 |
+} |
|
41 |
+ |
|
42 |
+function start_nicira() { |
|
43 |
+ : |
|
44 |
+} |
|
45 |
+ |
|
46 |
+function stop_nicira() { |
|
47 |
+ : |
|
48 |
+} |
|
49 |
+ |
|
50 |
+# Restore xtrace |
|
51 |
+$MY_XTRACE |
0 | 52 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,79 @@ |
0 |
+# Ryu OpenFlow Controller |
|
1 |
+# ----------------------- |
|
2 |
+ |
|
3 |
+# Save trace setting |
|
4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
5 |
+set +o xtrace |
|
6 |
+ |
|
7 |
+ |
|
8 |
+RYU_DIR=$DEST/ryu |
|
9 |
+# Ryu API Host |
|
10 |
+RYU_API_HOST=${RYU_API_HOST:-127.0.0.1} |
|
11 |
+# Ryu API Port |
|
12 |
+RYU_API_PORT=${RYU_API_PORT:-8080} |
|
13 |
+# Ryu OFP Host |
|
14 |
+RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1} |
|
15 |
+# Ryu OFP Port |
|
16 |
+RYU_OFP_PORT=${RYU_OFP_PORT:-6633} |
|
17 |
+# Ryu Applications |
|
18 |
+RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest} |
|
19 |
+ |
|
20 |
+# configure_ryu can be called multiple times as neutron_pluing/ryu may call |
|
21 |
+# this function for neutron-ryu-agent |
|
22 |
+_RYU_CONFIGURED=${_RYU_CONFIGURED:-False} |
|
23 |
+function configure_ryu() { |
|
24 |
+ if [[ "$_RYU_CONFIGURED" == "False" ]]; then |
|
25 |
+ setup_develop $RYU_DIR |
|
26 |
+ _RYU_CONFIGURED=True |
|
27 |
+ fi |
|
28 |
+} |
|
29 |
+ |
|
30 |
+function init_ryu() { |
|
31 |
+ RYU_CONF_DIR=/etc/ryu |
|
32 |
+ if [[ ! -d $RYU_CONF_DIR ]]; then |
|
33 |
+ sudo mkdir -p $RYU_CONF_DIR |
|
34 |
+ fi |
|
35 |
+ sudo chown $STACK_USER $RYU_CONF_DIR |
|
36 |
+ RYU_CONF=$RYU_CONF_DIR/ryu.conf |
|
37 |
+ sudo rm -rf $RYU_CONF |
|
38 |
+ |
|
39 |
+ # Ryu configuration |
|
40 |
+ RYU_CONF_CONTENTS=${RYU_CONF_CONTENTS:-"[DEFAULT] |
|
41 |
+app_lists=$RYU_APPS |
|
42 |
+wsapi_host=$RYU_API_HOST |
|
43 |
+wsapi_port=$RYU_API_PORT |
|
44 |
+ofp_listen_host=$RYU_OFP_HOST |
|
45 |
+ofp_tcp_listen_port=$RYU_OFP_PORT |
|
46 |
+neutron_url=http://$Q_HOST:$Q_PORT |
|
47 |
+neutron_admin_username=$Q_ADMIN_USERNAME |
|
48 |
+neutron_admin_password=$SERVICE_PASSWORD |
|
49 |
+neutron_admin_tenant_name=$SERVICE_TENANT_NAME |
|
50 |
+neutron_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0 |
|
51 |
+neutron_auth_strategy=$Q_AUTH_STRATEGY |
|
52 |
+neutron_controller_addr=tcp:$RYU_OFP_HOST:$RYU_OFP_PORT |
|
53 |
+"} |
|
54 |
+ echo "${RYU_CONF_CONTENTS}" > $RYU_CONF |
|
55 |
+} |
|
56 |
+ |
|
57 |
+# install_ryu can be called multiple times as neutron_pluing/ryu may call |
|
58 |
+# this function for neutron-ryu-agent |
|
59 |
+# Make this function idempotent and avoid cloning same repo many times |
|
60 |
+# with RECLONE=yes |
|
61 |
+_RYU_INSTALLED=${_RYU_INSTALLED:-False} |
|
62 |
+function install_ryu() { |
|
63 |
+ if [[ "$_RYU_INSTALLED" == "False" ]]; then |
|
64 |
+ git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH |
|
65 |
+ _RYU_INSTALLED=True |
|
66 |
+ fi |
|
67 |
+} |
|
68 |
+ |
|
69 |
+function start_ryu() { |
|
70 |
+ screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --config-file $RYU_CONF" |
|
71 |
+} |
|
72 |
+ |
|
73 |
+function stop_ryu() { |
|
74 |
+ : |
|
75 |
+} |
|
76 |
+ |
|
77 |
+# Restore xtrace |
|
78 |
+$MY_XTRACE |
0 | 79 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,113 @@ |
0 |
+# Trema Sliceable Switch |
|
1 |
+# ---------------------- |
|
2 |
+ |
|
3 |
+# Trema is a Full-Stack OpenFlow Framework in Ruby and C |
|
4 |
+# https://github.com/trema/trema |
|
5 |
+# |
|
6 |
+# Trema Sliceable Switch is an OpenFlow controller which provides |
|
7 |
+# virtual layer-2 network slices. |
|
8 |
+# https://github.com/trema/apps/wiki |
|
9 |
+ |
|
10 |
+# Trema Sliceable Switch (OpenFlow Controller) |
|
11 |
+TREMA_APPS_REPO=${TREMA_APPS_REPO:-https://github.com/trema/apps.git} |
|
12 |
+TREMA_APPS_BRANCH=${TREMA_APPS_BRANCH:-master} |
|
13 |
+ |
|
14 |
+# Save trace setting |
|
15 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
16 |
+set +o xtrace |
|
17 |
+ |
|
18 |
+TREMA_DIR=${TREMA_DIR:-$DEST/trema} |
|
19 |
+TREMA_SS_DIR="$TREMA_DIR/apps/sliceable_switch" |
|
20 |
+ |
|
21 |
+TREMA_DATA_DIR=${TREMA_DATA_DIR:-$DATA_DIR/trema} |
|
22 |
+TREMA_SS_ETC_DIR=$TREMA_DATA_DIR/sliceable_switch/etc |
|
23 |
+TREMA_SS_DB_DIR=$TREMA_DATA_DIR/sliceable_switch/db |
|
24 |
+TREMA_SS_SCRIPT_DIR=$TREMA_DATA_DIR/sliceable_switch/script |
|
25 |
+TREMA_TMP_DIR=$TREMA_DATA_DIR/trema |
|
26 |
+ |
|
27 |
+TREMA_LOG_LEVEL=${TREMA_LOG_LEVEL:-info} |
|
28 |
+ |
|
29 |
+TREMA_SS_CONFIG=$TREMA_SS_ETC_DIR/sliceable.conf |
|
30 |
+TREMA_SS_APACHE_CONFIG=/etc/apache2/sites-available/sliceable_switch |
|
31 |
+ |
|
32 |
+# configure_trema - Set config files, create data dirs, etc |
|
33 |
+function configure_trema() { |
|
34 |
+ # prepare dir |
|
35 |
+ for d in $TREMA_SS_ETC_DIR $TREMA_SS_DB_DIR $TREMA_SS_SCRIPT_DIR; do |
|
36 |
+ sudo mkdir -p $d |
|
37 |
+ sudo chown -R `whoami` $d |
|
38 |
+ done |
|
39 |
+ sudo mkdir -p $TREMA_TMP_DIR |
|
40 |
+} |
|
41 |
+ |
|
42 |
+# init_trema - Initialize databases, etc. |
|
43 |
+function init_trema() { |
|
44 |
+ local _pwd=$(pwd) |
|
45 |
+ |
|
46 |
+ # Initialize databases for Sliceable Switch |
|
47 |
+ cd $TREMA_SS_DIR |
|
48 |
+ rm -f filter.db slice.db |
|
49 |
+ ./create_tables.sh |
|
50 |
+ mv filter.db slice.db $TREMA_SS_DB_DIR |
|
51 |
+ # Make sure that apache cgi has write access to the databases |
|
52 |
+ sudo chown -R www-data.www-data $TREMA_SS_DB_DIR |
|
53 |
+ cd $_pwd |
|
54 |
+ |
|
55 |
+ # Setup HTTP Server for sliceable_switch |
|
56 |
+ cp $TREMA_SS_DIR/{Slice.pm,Filter.pm,config.cgi} $TREMA_SS_SCRIPT_DIR |
|
57 |
+ sed -i -e "s|/home/sliceable_switch/db|$TREMA_SS_DB_DIR|" \ |
|
58 |
+ $TREMA_SS_SCRIPT_DIR/config.cgi |
|
59 |
+ |
|
60 |
+ sudo cp $TREMA_SS_DIR/apache/sliceable_switch $TREMA_SS_APACHE_CONFIG |
|
61 |
+ sudo sed -i -e "s|/home/sliceable_switch/script|$TREMA_SS_SCRIPT_DIR|" \ |
|
62 |
+ $TREMA_SS_APACHE_CONFIG |
|
63 |
+ sudo a2enmod rewrite actions |
|
64 |
+ sudo a2ensite sliceable_switch |
|
65 |
+ |
|
66 |
+ cp $TREMA_SS_DIR/sliceable_switch_null.conf $TREMA_SS_CONFIG |
|
67 |
+ sed -i -e "s|^\$apps_dir.*$|\$apps_dir = \"$TREMA_DIR/apps\"|" \ |
|
68 |
+ -e "s|^\$db_dir.*$|\$db_dir = \"$TREMA_SS_DB_DIR\"|" \ |
|
69 |
+ $TREMA_SS_CONFIG |
|
70 |
+} |
|
71 |
+ |
|
72 |
+function gem_install() { |
|
73 |
+ [[ "$OFFLINE" = "True" ]] && return |
|
74 |
+ [ -n "$RUBYGEMS_CMD" ] || get_gem_command |
|
75 |
+ |
|
76 |
+ local pkg=$1 |
|
77 |
+ $RUBYGEMS_CMD list | grep "^${pkg} " && return |
|
78 |
+ sudo $RUBYGEMS_CMD install $pkg |
|
79 |
+} |
|
80 |
+ |
|
81 |
+function get_gem_command() { |
|
82 |
+ # Trema requires ruby 1.8, so gem1.8 is checked first |
|
83 |
+ RUBYGEMS_CMD=$(which gem1.8 || which gem) |
|
84 |
+ if [ -z "$RUBYGEMS_CMD" ]; then |
|
85 |
+ echo "Warning: ruby gems command not found." |
|
86 |
+ fi |
|
87 |
+} |
|
88 |
+ |
|
89 |
+function install_trema() { |
|
90 |
+ # Trema |
|
91 |
+ gem_install trema |
|
92 |
+ # Sliceable Switch |
|
93 |
+ git_clone $TREMA_APPS_REPO $TREMA_DIR/apps $TREMA_APPS_BRANCH |
|
94 |
+ make -C $TREMA_DIR/apps/topology |
|
95 |
+ make -C $TREMA_DIR/apps/flow_manager |
|
96 |
+ make -C $TREMA_DIR/apps/sliceable_switch |
|
97 |
+} |
|
98 |
+ |
|
99 |
+function start_trema() { |
|
100 |
+ # APACHE_NAME is defined in init_horizon (in lib/horizon) |
|
101 |
+ restart_service $APACHE_NAME |
|
102 |
+ |
|
103 |
+ sudo LOGGING_LEVEL=$TREMA_LOG_LEVEL TREMA_TMP=$TREMA_TMP_DIR \ |
|
104 |
+ trema run -d -c $TREMA_SS_CONFIG |
|
105 |
+} |
|
106 |
+ |
|
107 |
+function stop_trema() { |
|
108 |
+ sudo TREMA_TMP=$TREMA_TMP_DIR trema killall |
|
109 |
+} |
|
110 |
+ |
|
111 |
+# Restore xtrace |
|
112 |
+$MY_XTRACE |
... | ... |
@@ -81,7 +81,7 @@ if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
81 | 81 |
GUEST_INTERFACE_DEFAULT=eth1 |
82 | 82 |
# Allow ``build_domU.sh`` to specify the flat network bridge via kernel args |
83 | 83 |
FLAT_NETWORK_BRIDGE_DEFAULT=$(sed -e 's/.* flat_network_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline) |
84 |
- if is_service_enabled quantum; then |
|
84 |
+ if is_service_enabled neutron; then |
|
85 | 85 |
XEN_INTEGRATION_BRIDGE=$(sed -e 's/.* xen_integration_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline) |
86 | 86 |
fi |
87 | 87 |
elif [ "$VIRT_DRIVER" = 'baremetal' ]; then |
... | ... |
@@ -281,7 +281,7 @@ function configure_nova() { |
281 | 281 |
fi |
282 | 282 |
|
283 | 283 |
if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then |
284 |
- if is_service_enabled quantum && is_quantum_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF; then |
|
284 |
+ if is_service_enabled neutron && is_neutron_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF; then |
|
285 | 285 |
# Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces |
286 | 286 |
cat <<EOF | sudo tee -a $QEMU_CONF |
287 | 287 |
cgroup_device_acl = [ |
288 | 288 |
deleted file mode 100644 |
... | ... |
@@ -1,808 +0,0 @@ |
1 |
-# lib/quantum |
|
2 |
-# functions - funstions specific to quantum |
|
3 |
- |
|
4 |
-# Dependencies: |
|
5 |
-# ``functions`` file |
|
6 |
-# ``DEST`` must be defined |
|
7 |
- |
|
8 |
-# ``stack.sh`` calls the entry points in this order: |
|
9 |
-# |
|
10 |
-# install_quantum |
|
11 |
-# install_quantumclient |
|
12 |
-# install_quantum_agent_packages |
|
13 |
-# install_quantum_third_party |
|
14 |
-# configure_quantum |
|
15 |
-# init_quantum |
|
16 |
-# configure_quantum_third_party |
|
17 |
-# init_quantum_third_party |
|
18 |
-# start_quantum_third_party |
|
19 |
-# create_nova_conf_quantum |
|
20 |
-# start_quantum_service_and_check |
|
21 |
-# create_quantum_initial_network |
|
22 |
-# setup_quantum_debug |
|
23 |
-# start_quantum_agents |
|
24 |
-# |
|
25 |
-# ``unstack.sh`` calls the entry points in this order: |
|
26 |
-# |
|
27 |
-# stop_quantum |
|
28 |
- |
|
29 |
-# Functions in lib/quantum are classified into the following categories: |
|
30 |
-# |
|
31 |
-# - entry points (called from stack.sh or unstack.sh) |
|
32 |
-# - internal functions |
|
33 |
-# - quantum exercises |
|
34 |
-# - 3rd party programs |
|
35 |
- |
|
36 |
- |
|
37 |
-# Quantum Networking |
|
38 |
-# ------------------ |
|
39 |
- |
|
40 |
-# Make sure that quantum is enabled in ``ENABLED_SERVICES``. If you want |
|
41 |
-# to run Quantum on this host, make sure that q-svc is also in |
|
42 |
-# ``ENABLED_SERVICES``. |
|
43 |
-# |
|
44 |
-# If you're planning to use the Quantum openvswitch plugin, set |
|
45 |
-# ``Q_PLUGIN`` to "openvswitch" and make sure the q-agt service is enabled |
|
46 |
-# in ``ENABLED_SERVICES``. If you're planning to use the Quantum |
|
47 |
-# linuxbridge plugin, set ``Q_PLUGIN`` to "linuxbridge" and make sure the |
|
48 |
-# q-agt service is enabled in ``ENABLED_SERVICES``. |
|
49 |
-# |
|
50 |
-# See "Quantum Network Configuration" below for additional variables |
|
51 |
-# that must be set in localrc for connectivity across hosts with |
|
52 |
-# Quantum. |
|
53 |
-# |
|
54 |
-# With Quantum networking the NETWORK_MANAGER variable is ignored. |
|
55 |
-# |
|
56 |
-# To enable specific configuration options for either the Open vSwitch or |
|
57 |
-# LinuxBridge plugin, please see the top level README file under the |
|
58 |
-# Quantum section. |
|
59 |
- |
|
60 |
-# Save trace setting |
|
61 |
-XTRACE=$(set +o | grep xtrace) |
|
62 |
-set +o xtrace |
|
63 |
- |
|
64 |
- |
|
65 |
-# Quantum Network Configuration |
|
66 |
-# ----------------------------- |
|
67 |
- |
|
68 |
-# Gateway and subnet defaults, in case they are not customized in localrc |
|
69 |
-NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1} |
|
70 |
-PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.225} |
|
71 |
-PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"} |
|
72 |
-PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"} |
|
73 |
- |
|
74 |
-# Set up default directories |
|
75 |
-QUANTUM_DIR=$DEST/neutron |
|
76 |
-QUANTUMCLIENT_DIR=$DEST/python-neutronclient |
|
77 |
-QUANTUM_AUTH_CACHE_DIR=${QUANTUM_AUTH_CACHE_DIR:-/var/cache/quantum} |
|
78 |
- |
|
79 |
-QUANTUM_CONF_DIR=/etc/quantum |
|
80 |
-QUANTUM_CONF=$QUANTUM_CONF_DIR/quantum.conf |
|
81 |
-export QUANTUM_TEST_CONFIG_FILE=${QUANTUM_TEST_CONFIG_FILE:-"$QUANTUM_CONF_DIR/debug.ini"} |
|
82 |
- |
|
83 |
-# Default Quantum Plugin |
|
84 |
-Q_PLUGIN=${Q_PLUGIN:-openvswitch} |
|
85 |
-# Default Quantum Port |
|
86 |
-Q_PORT=${Q_PORT:-9696} |
|
87 |
-# Default Quantum Host |
|
88 |
-Q_HOST=${Q_HOST:-$SERVICE_HOST} |
|
89 |
-# Default admin username |
|
90 |
-Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-quantum} |
|
91 |
-# Default auth strategy |
|
92 |
-Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone} |
|
93 |
-# Use namespace or not |
|
94 |
-Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True} |
|
95 |
-# RHEL's support for namespaces requires using veths with ovs |
|
96 |
-Q_OVS_USE_VETH=${Q_OVS_USE_VETH:-False} |
|
97 |
-Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True} |
|
98 |
-# Meta data IP |
|
99 |
-Q_META_DATA_IP=${Q_META_DATA_IP:-$SERVICE_HOST} |
|
100 |
-# Allow Overlapping IP among subnets |
|
101 |
-Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True} |
|
102 |
-# Use quantum-debug command |
|
103 |
-Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False} |
|
104 |
-# The name of the default q-l3 router |
|
105 |
-Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1} |
|
106 |
-# List of config file names in addition to the main plugin config file |
|
107 |
-# See _configure_quantum_common() for details about setting it up |
|
108 |
-declare -a Q_PLUGIN_EXTRA_CONF_FILES |
|
109 |
- |
|
110 |
-if is_service_enabled quantum; then |
|
111 |
- Q_RR_CONF_FILE=$QUANTUM_CONF_DIR/rootwrap.conf |
|
112 |
- if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then |
|
113 |
- Q_RR_COMMAND="sudo" |
|
114 |
- else |
|
115 |
- QUANTUM_ROOTWRAP=$(get_rootwrap_location quantum) |
|
116 |
- Q_RR_COMMAND="sudo $QUANTUM_ROOTWRAP $Q_RR_CONF_FILE" |
|
117 |
- fi |
|
118 |
- |
|
119 |
- # Provider Network Configurations |
|
120 |
- # -------------------------------- |
|
121 |
- |
|
122 |
- # The following variables control the Quantum openvswitch and |
|
123 |
- # linuxbridge plugins' allocation of tenant networks and |
|
124 |
- # availability of provider networks. If these are not configured |
|
125 |
- # in ``localrc``, tenant networks will be local to the host (with no |
|
126 |
- # remote connectivity), and no physical resources will be |
|
127 |
- # available for the allocation of provider networks. |
|
128 |
- |
|
129 |
- # To use GRE tunnels for tenant networks, set to True in |
|
130 |
- # ``localrc``. GRE tunnels are only supported by the openvswitch |
|
131 |
- # plugin, and currently only on Ubuntu. |
|
132 |
- ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False} |
|
133 |
- |
|
134 |
- # If using GRE tunnels for tenant networks, specify the range of |
|
135 |
- # tunnel IDs from which tenant networks are allocated. Can be |
|
136 |
- # overriden in ``localrc`` in necesssary. |
|
137 |
- TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGE:-1:1000} |
|
138 |
- |
|
139 |
- # To use VLANs for tenant networks, set to True in localrc. VLANs |
|
140 |
- # are supported by the openvswitch and linuxbridge plugins, each |
|
141 |
- # requiring additional configuration described below. |
|
142 |
- ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False} |
|
143 |
- |
|
144 |
- # If using VLANs for tenant networks, set in ``localrc`` to specify |
|
145 |
- # the range of VLAN VIDs from which tenant networks are |
|
146 |
- # allocated. An external network switch must be configured to |
|
147 |
- # trunk these VLANs between hosts for multi-host connectivity. |
|
148 |
- # |
|
149 |
- # Example: ``TENANT_VLAN_RANGE=1000:1999`` |
|
150 |
- TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-} |
|
151 |
- |
|
152 |
- # If using VLANs for tenant networks, or if using flat or VLAN |
|
153 |
- # provider networks, set in ``localrc`` to the name of the physical |
|
154 |
- # network, and also configure ``OVS_PHYSICAL_BRIDGE`` for the |
|
155 |
- # openvswitch agent or ``LB_PHYSICAL_INTERFACE`` for the linuxbridge |
|
156 |
- # agent, as described below. |
|
157 |
- # |
|
158 |
- # Example: ``PHYSICAL_NETWORK=default`` |
|
159 |
- PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-} |
|
160 |
- |
|
161 |
- # With the openvswitch plugin, if using VLANs for tenant networks, |
|
162 |
- # or if using flat or VLAN provider networks, set in ``localrc`` to |
|
163 |
- # the name of the OVS bridge to use for the physical network. The |
|
164 |
- # bridge will be created if it does not already exist, but a |
|
165 |
- # physical interface must be manually added to the bridge as a |
|
166 |
- # port for external connectivity. |
|
167 |
- # |
|
168 |
- # Example: ``OVS_PHYSICAL_BRIDGE=br-eth1`` |
|
169 |
- OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-} |
|
170 |
- |
|
171 |
- # With the linuxbridge plugin, if using VLANs for tenant networks, |
|
172 |
- # or if using flat or VLAN provider networks, set in ``localrc`` to |
|
173 |
- # the name of the network interface to use for the physical |
|
174 |
- # network. |
|
175 |
- # |
|
176 |
- # Example: ``LB_PHYSICAL_INTERFACE=eth1`` |
|
177 |
- LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-} |
|
178 |
- |
|
179 |
- # With the openvswitch plugin, set to True in ``localrc`` to enable |
|
180 |
- # provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False. |
|
181 |
- # |
|
182 |
- # Example: ``OVS_ENABLE_TUNNELING=True`` |
|
183 |
- OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS} |
|
184 |
-fi |
|
185 |
- |
|
186 |
-# Quantum plugin specific functions |
|
187 |
-# --------------------------------- |
|
188 |
- |
|
189 |
-# Please refer to ``lib/quantum_plugins/README.md`` for details. |
|
190 |
-source $TOP_DIR/lib/quantum_plugins/$Q_PLUGIN |
|
191 |
- |
|
192 |
-# Agent loadbalancer service plugin functions |
|
193 |
-# ------------------------------------------- |
|
194 |
- |
|
195 |
-# Hardcoding for 1 service plugin for now |
|
196 |
-source $TOP_DIR/lib/quantum_plugins/services/loadbalancer |
|
197 |
- |
|
198 |
-# Use security group or not |
|
199 |
-if has_quantum_plugin_security_group; then |
|
200 |
- Q_USE_SECGROUP=${Q_USE_SECGROUP:-True} |
|
201 |
-else |
|
202 |
- Q_USE_SECGROUP=False |
|
203 |
-fi |
|
204 |
- |
|
205 |
-# Functions |
|
206 |
-# --------- |
|
207 |
- |
|
208 |
-# configure_quantum() |
|
209 |
-# Set common config for all quantum server and agents. |
|
210 |
-function configure_quantum() { |
|
211 |
- _configure_quantum_common |
|
212 |
- iniset_rpc_backend quantum $QUANTUM_CONF DEFAULT |
|
213 |
- |
|
214 |
- # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES |
|
215 |
- if is_service_enabled q-lbaas; then |
|
216 |
- _configure_quantum_lbaas |
|
217 |
- fi |
|
218 |
- if is_service_enabled q-svc; then |
|
219 |
- _configure_quantum_service |
|
220 |
- fi |
|
221 |
- if is_service_enabled q-agt; then |
|
222 |
- _configure_quantum_plugin_agent |
|
223 |
- fi |
|
224 |
- if is_service_enabled q-dhcp; then |
|
225 |
- _configure_quantum_dhcp_agent |
|
226 |
- fi |
|
227 |
- if is_service_enabled q-l3; then |
|
228 |
- _configure_quantum_l3_agent |
|
229 |
- fi |
|
230 |
- if is_service_enabled q-meta; then |
|
231 |
- _configure_quantum_metadata_agent |
|
232 |
- fi |
|
233 |
- |
|
234 |
- _configure_quantum_debug_command |
|
235 |
-} |
|
236 |
- |
|
237 |
-function create_nova_conf_quantum() { |
|
238 |
- iniset $NOVA_CONF DEFAULT network_api_class "nova.network.quantumv2.api.API" |
|
239 |
- iniset $NOVA_CONF DEFAULT quantum_admin_username "$Q_ADMIN_USERNAME" |
|
240 |
- iniset $NOVA_CONF DEFAULT quantum_admin_password "$SERVICE_PASSWORD" |
|
241 |
- iniset $NOVA_CONF DEFAULT quantum_admin_auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0" |
|
242 |
- iniset $NOVA_CONF DEFAULT quantum_auth_strategy "$Q_AUTH_STRATEGY" |
|
243 |
- iniset $NOVA_CONF DEFAULT quantum_admin_tenant_name "$SERVICE_TENANT_NAME" |
|
244 |
- iniset $NOVA_CONF DEFAULT quantum_url "http://$Q_HOST:$Q_PORT" |
|
245 |
- |
|
246 |
- if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
247 |
- LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver |
|
248 |
- iniset $NOVA_CONF DEFAULT security_group_api quantum |
|
249 |
- fi |
|
250 |
- |
|
251 |
- # set NOVA_VIF_DRIVER and optionally set options in nova_conf |
|
252 |
- quantum_plugin_create_nova_conf |
|
253 |
- |
|
254 |
- iniset $NOVA_CONF DEFAULT libvirt_vif_driver "$NOVA_VIF_DRIVER" |
|
255 |
- iniset $NOVA_CONF DEFAULT linuxnet_interface_driver "$LINUXNET_VIF_DRIVER" |
|
256 |
- if is_service_enabled q-meta; then |
|
257 |
- iniset $NOVA_CONF DEFAULT service_quantum_metadata_proxy "True" |
|
258 |
- fi |
|
259 |
-} |
|
260 |
- |
|
261 |
-# create_quantum_accounts() - Set up common required quantum accounts |
|
262 |
- |
|
263 |
-# Tenant User Roles |
|
264 |
-# ------------------------------------------------------------------ |
|
265 |
-# service quantum admin # if enabled |
|
266 |
- |
|
267 |
-# Migrated from keystone_data.sh |
|
268 |
-function create_quantum_accounts() { |
|
269 |
- |
|
270 |
- SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }") |
|
271 |
- ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }") |
|
272 |
- |
|
273 |
- if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then |
|
274 |
- QUANTUM_USER=$(keystone user-create \ |
|
275 |
- --name=quantum \ |
|
276 |
- --pass="$SERVICE_PASSWORD" \ |
|
277 |
- --tenant_id $SERVICE_TENANT \ |
|
278 |
- --email=quantum@example.com \ |
|
279 |
- | grep " id " | get_field 2) |
|
280 |
- keystone user-role-add \ |
|
281 |
- --tenant_id $SERVICE_TENANT \ |
|
282 |
- --user_id $QUANTUM_USER \ |
|
283 |
- --role_id $ADMIN_ROLE |
|
284 |
- if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
|
285 |
- QUANTUM_SERVICE=$(keystone service-create \ |
|
286 |
- --name=quantum \ |
|
287 |
- --type=network \ |
|
288 |
- --description="Quantum Service" \ |
|
289 |
- | grep " id " | get_field 2) |
|
290 |
- keystone endpoint-create \ |
|
291 |
- --region RegionOne \ |
|
292 |
- --service_id $QUANTUM_SERVICE \ |
|
293 |
- --publicurl "http://$SERVICE_HOST:9696/" \ |
|
294 |
- --adminurl "http://$SERVICE_HOST:9696/" \ |
|
295 |
- --internalurl "http://$SERVICE_HOST:9696/" |
|
296 |
- fi |
|
297 |
- fi |
|
298 |
-} |
|
299 |
- |
|
300 |
-function create_quantum_initial_network() { |
|
301 |
- TENANT_ID=$(keystone tenant-list | grep " demo " | get_field 1) |
|
302 |
- |
|
303 |
- # Create a small network |
|
304 |
- # Since quantum command is executed in admin context at this point, |
|
305 |
- # ``--tenant_id`` needs to be specified. |
|
306 |
- if is_baremetal; then |
|
307 |
- sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE |
|
308 |
- for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do |
|
309 |
- sudo ip addr del $IP dev $PUBLIC_INTERFACE |
|
310 |
- sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE |
|
311 |
- done |
|
312 |
- NET_ID=$(quantum net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2) |
|
313 |
- SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) |
|
314 |
- sudo ifconfig $OVS_PHYSICAL_BRIDGE up |
|
315 |
- else |
|
316 |
- NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2) |
|
317 |
- SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) |
|
318 |
- fi |
|
319 |
- |
|
320 |
- if [[ "$Q_L3_ENABLED" == "True" ]]; then |
|
321 |
- # Create a router, and add the private subnet as one of its interfaces |
|
322 |
- if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then |
|
323 |
- # create a tenant-owned router. |
|
324 |
- ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID $Q_ROUTER_NAME | grep ' id ' | get_field 2) |
|
325 |
- else |
|
326 |
- # Plugin only supports creating a single router, which should be admin owned. |
|
327 |
- ROUTER_ID=$(quantum router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2) |
|
328 |
- fi |
|
329 |
- quantum router-interface-add $ROUTER_ID $SUBNET_ID |
|
330 |
- # Create an external network, and a subnet. Configure the external network as router gw |
|
331 |
- EXT_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2) |
|
332 |
- EXT_GW_IP=$(quantum subnet-create --ip_version 4 ${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} --gateway $PUBLIC_NETWORK_GATEWAY --name $PUBLIC_SUBNET_NAME $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2) |
|
333 |
- quantum router-gateway-set $ROUTER_ID $EXT_NET_ID |
|
334 |
- |
|
335 |
- if is_service_enabled q-l3; then |
|
336 |
- # logic is specific to using the l3-agent for l3 |
|
337 |
- if is_quantum_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then |
|
338 |
- CIDR_LEN=${FLOATING_RANGE#*/} |
|
339 |
- sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE |
|
340 |
- sudo ip link set $PUBLIC_BRIDGE up |
|
341 |
- ROUTER_GW_IP=`quantum port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'` |
|
342 |
- sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP |
|
343 |
- fi |
|
344 |
- if [[ "$Q_USE_NAMESPACE" == "False" ]]; then |
|
345 |
- # Explicitly set router id in l3 agent configuration |
|
346 |
- iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID |
|
347 |
- fi |
|
348 |
- fi |
|
349 |
- fi |
|
350 |
-} |
|
351 |
- |
|
352 |
-# init_quantum() - Initialize databases, etc. |
|
353 |
-function init_quantum() { |
|
354 |
- : |
|
355 |
-} |
|
356 |
- |
|
357 |
-# install_quantum() - Collect source and prepare |
|
358 |
-function install_quantum() { |
|
359 |
- git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH |
|
360 |
- setup_develop $QUANTUM_DIR |
|
361 |
-} |
|
362 |
- |
|
363 |
-# install_quantumclient() - Collect source and prepare |
|
364 |
-function install_quantumclient() { |
|
365 |
- git_clone $QUANTUMCLIENT_REPO $QUANTUMCLIENT_DIR $QUANTUMCLIENT_BRANCH |
|
366 |
- setup_develop $QUANTUMCLIENT_DIR |
|
367 |
-} |
|
368 |
- |
|
369 |
-# install_quantum_agent_packages() - Collect source and prepare |
|
370 |
-function install_quantum_agent_packages() { |
|
371 |
- # install packages that are specific to plugin agent(s) |
|
372 |
- if is_service_enabled q-agt q-dhcp q-l3; then |
|
373 |
- quantum_plugin_install_agent_packages |
|
374 |
- fi |
|
375 |
- |
|
376 |
- if is_service_enabled q-lbaas; then |
|
377 |
- quantum_agent_lbaas_install_agent_packages |
|
378 |
- fi |
|
379 |
-} |
|
380 |
- |
|
381 |
-# Start running processes, including screen |
|
382 |
-function start_quantum_service_and_check() { |
|
383 |
- # build config-file options |
|
384 |
- local cfg_file |
|
385 |
- local CFG_FILE_OPTIONS="--config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
386 |
- for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do |
|
387 |
- CFG_FILE_OPTIONS+=" --config-file /$cfg_file" |
|
388 |
- done |
|
389 |
- # Start the Quantum service |
|
390 |
- screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server $CFG_FILE_OPTIONS" |
|
391 |
- echo "Waiting for Quantum to start..." |
|
392 |
- if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then |
|
393 |
- die $LINENO "Quantum did not start" |
|
394 |
- fi |
|
395 |
-} |
|
396 |
- |
|
397 |
-# Start running processes, including screen |
|
398 |
-function start_quantum_agents() { |
|
399 |
- # Start up the quantum agents if enabled |
|
400 |
- screen_it q-agt "cd $QUANTUM_DIR && python $AGENT_BINARY --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE" |
|
401 |
- screen_it q-dhcp "cd $QUANTUM_DIR && python $AGENT_DHCP_BINARY --config-file $QUANTUM_CONF --config-file=$Q_DHCP_CONF_FILE" |
|
402 |
- screen_it q-l3 "cd $QUANTUM_DIR && python $AGENT_L3_BINARY --config-file $QUANTUM_CONF --config-file=$Q_L3_CONF_FILE" |
|
403 |
- screen_it q-meta "cd $QUANTUM_DIR && python $AGENT_META_BINARY --config-file $QUANTUM_CONF --config-file=$Q_META_CONF_FILE" |
|
404 |
- |
|
405 |
- if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
406 |
- # For XenServer, start an agent for the domU openvswitch |
|
407 |
- screen_it q-domua "cd $QUANTUM_DIR && python $AGENT_BINARY --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE.domU" |
|
408 |
- fi |
|
409 |
- |
|
410 |
- if is_service_enabled q-lbaas; then |
|
411 |
- screen_it q-lbaas "cd $QUANTUM_DIR && python $AGENT_LBAAS_BINARY --config-file $QUANTUM_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME" |
|
412 |
- fi |
|
413 |
-} |
|
414 |
- |
|
415 |
-# stop_quantum() - Stop running processes (non-screen) |
|
416 |
-function stop_quantum() { |
|
417 |
- if is_service_enabled q-dhcp; then |
|
418 |
- pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }') |
|
419 |
- [ ! -z "$pid" ] && sudo kill -9 $pid |
|
420 |
- fi |
|
421 |
- if is_service_enabled q-meta; then |
|
422 |
- pid=$(ps aux | awk '/quantum-ns-metadata-proxy/ { print $2 }') |
|
423 |
- [ ! -z "$pid" ] && sudo kill -9 $pid |
|
424 |
- fi |
|
425 |
-} |
|
426 |
- |
|
427 |
-# cleanup_quantum() - Remove residual data files, anything left over from previous |
|
428 |
-# runs that a clean run would need to clean up |
|
429 |
-function cleanup_quantum() { |
|
430 |
- if is_quantum_ovs_base_plugin; then |
|
431 |
- quantum_ovs_base_cleanup |
|
432 |
- fi |
|
433 |
- |
|
434 |
- # delete all namespaces created by quantum |
|
435 |
- for ns in $(sudo ip netns list | grep -o -e qdhcp-[0-9a-f\-]* -e qrouter-[0-9a-f\-]*); do |
|
436 |
- sudo ip netns delete ${ns} |
|
437 |
- done |
|
438 |
-} |
|
439 |
- |
|
440 |
-# _configure_quantum_common() |
|
441 |
-# Set common config for all quantum server and agents. |
|
442 |
-# This MUST be called before other ``_configure_quantum_*`` functions. |
|
443 |
-function _configure_quantum_common() { |
|
444 |
- # Put config files in ``QUANTUM_CONF_DIR`` for everyone to find |
|
445 |
- if [[ ! -d $QUANTUM_CONF_DIR ]]; then |
|
446 |
- sudo mkdir -p $QUANTUM_CONF_DIR |
|
447 |
- fi |
|
448 |
- sudo chown $STACK_USER $QUANTUM_CONF_DIR |
|
449 |
- |
|
450 |
- cp $QUANTUM_DIR/etc/quantum.conf $QUANTUM_CONF |
|
451 |
- |
|
452 |
- # Set plugin-specific variables ``Q_DB_NAME``, ``Q_PLUGIN_CLASS``. |
|
453 |
- # For main plugin config file, set ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``. |
|
454 |
- # For addition plugin config files, set ``Q_PLUGIN_EXTRA_CONF_PATH``, |
|
455 |
- # ``Q_PLUGIN_EXTRA_CONF_FILES``. For example: |
|
456 |
- # ``Q_PLUGIN_EXTRA_CONF_FILES=(file1, file2)`` |
|
457 |
- quantum_plugin_configure_common |
|
458 |
- |
|
459 |
- if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then |
|
460 |
- die $LINENO "Quantum plugin not set.. exiting" |
|
461 |
- fi |
|
462 |
- |
|
463 |
- # If needed, move config file from ``$QUANTUM_DIR/etc/quantum`` to ``QUANTUM_CONF_DIR`` |
|
464 |
- mkdir -p /$Q_PLUGIN_CONF_PATH |
|
465 |
- Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME |
|
466 |
- cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE |
|
467 |
- |
|
468 |
- iniset /$Q_PLUGIN_CONF_FILE database connection `database_connection_url $Q_DB_NAME` |
|
469 |
- iniset $QUANTUM_CONF DEFAULT state_path $DATA_DIR/quantum |
|
470 |
- |
|
471 |
- # If addition config files are set, make sure their path name is set as well |
|
472 |
- if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then |
|
473 |
- die $LINENO "Quantum additional plugin config not set.. exiting" |
|
474 |
- fi |
|
475 |
- |
|
476 |
- # If additional config files exist, copy them over to quantum configuration |
|
477 |
- # directory |
|
478 |
- if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then |
|
479 |
- mkdir -p /$Q_PLUGIN_EXTRA_CONF_PATH |
|
480 |
- local f |
|
481 |
- for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do |
|
482 |
- Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]} |
|
483 |
- cp $QUANTUM_DIR/${Q_PLUGIN_EXTRA_CONF_FILES[$f]} /${Q_PLUGIN_EXTRA_CONF_FILES[$f]} |
|
484 |
- done |
|
485 |
- fi |
|
486 |
- |
|
487 |
- _quantum_setup_rootwrap |
|
488 |
-} |
|
489 |
- |
|
490 |
-function _configure_quantum_debug_command() { |
|
491 |
- if [[ "$Q_USE_DEBUG_COMMAND" != "True" ]]; then |
|
492 |
- return |
|
493 |
- fi |
|
494 |
- |
|
495 |
- cp $QUANTUM_DIR/etc/l3_agent.ini $QUANTUM_TEST_CONFIG_FILE |
|
496 |
- |
|
497 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT verbose False |
|
498 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT debug False |
|
499 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
500 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
501 |
- # Intermediate fix until Quantum patch lands and then line above will |
|
502 |
- # be cleaned. |
|
503 |
- iniset $QUANTUM_TEST_CONFIG_FILE agent root_helper "$Q_RR_COMMAND" |
|
504 |
- |
|
505 |
- _quantum_setup_keystone $QUANTUM_TEST_CONFIG_FILE DEFAULT set_auth_url |
|
506 |
- _quantum_setup_interface_driver $QUANTUM_TEST_CONFIG_FILE |
|
507 |
- |
|
508 |
- quantum_plugin_configure_debug_command |
|
509 |
-} |
|
510 |
- |
|
511 |
-function _configure_quantum_dhcp_agent() { |
|
512 |
- AGENT_DHCP_BINARY="$QUANTUM_DIR/bin/quantum-dhcp-agent" |
|
513 |
- Q_DHCP_CONF_FILE=$QUANTUM_CONF_DIR/dhcp_agent.ini |
|
514 |
- |
|
515 |
- cp $QUANTUM_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE |
|
516 |
- |
|
517 |
- iniset $Q_DHCP_CONF_FILE DEFAULT verbose True |
|
518 |
- iniset $Q_DHCP_CONF_FILE DEFAULT debug True |
|
519 |
- iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
520 |
- iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
521 |
- |
|
522 |
- _quantum_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url |
|
523 |
- _quantum_setup_interface_driver $Q_DHCP_CONF_FILE |
|
524 |
- |
|
525 |
- quantum_plugin_configure_dhcp_agent |
|
526 |
-} |
|
527 |
- |
|
528 |
-function _configure_quantum_l3_agent() { |
|
529 |
- Q_L3_ENABLED=True |
|
530 |
- # for l3-agent, only use per tenant router if we have namespaces |
|
531 |
- Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE |
|
532 |
- AGENT_L3_BINARY="$QUANTUM_DIR/bin/quantum-l3-agent" |
|
533 |
- Q_L3_CONF_FILE=$QUANTUM_CONF_DIR/l3_agent.ini |
|
534 |
- |
|
535 |
- cp $QUANTUM_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE |
|
536 |
- |
|
537 |
- iniset $Q_L3_CONF_FILE DEFAULT verbose True |
|
538 |
- iniset $Q_L3_CONF_FILE DEFAULT debug True |
|
539 |
- iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
540 |
- iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
541 |
- |
|
542 |
- _quantum_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url |
|
543 |
- _quantum_setup_interface_driver $Q_L3_CONF_FILE |
|
544 |
- |
|
545 |
- quantum_plugin_configure_l3_agent |
|
546 |
-} |
|
547 |
- |
|
548 |
-function _configure_quantum_metadata_agent() { |
|
549 |
- AGENT_META_BINARY="$QUANTUM_DIR/bin/quantum-metadata-agent" |
|
550 |
- Q_META_CONF_FILE=$QUANTUM_CONF_DIR/metadata_agent.ini |
|
551 |
- |
|
552 |
- cp $QUANTUM_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE |
|
553 |
- |
|
554 |
- iniset $Q_META_CONF_FILE DEFAULT verbose True |
|
555 |
- iniset $Q_META_CONF_FILE DEFAULT debug True |
|
556 |
- iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP |
|
557 |
- iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND" |
|
558 |
- |
|
559 |
- _quantum_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url |
|
560 |
-} |
|
561 |
- |
|
562 |
-function _configure_quantum_lbaas() { |
|
563 |
- quantum_agent_lbaas_configure_common |
|
564 |
- quantum_agent_lbaas_configure_agent |
|
565 |
-} |
|
566 |
- |
|
567 |
-# _configure_quantum_plugin_agent() - Set config files for quantum plugin agent |
|
568 |
-# It is called when q-agt is enabled. |
|
569 |
-function _configure_quantum_plugin_agent() { |
|
570 |
- # Specify the default root helper prior to agent configuration to |
|
571 |
- # ensure that an agent's configuration can override the default |
|
572 |
- iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_COMMAND" |
|
573 |
- iniset $QUANTUM_CONF DEFAULT verbose True |
|
574 |
- iniset $QUANTUM_CONF DEFAULT debug True |
|
575 |
- |
|
576 |
- # Configure agent for plugin |
|
577 |
- quantum_plugin_configure_plugin_agent |
|
578 |
-} |
|
579 |
- |
|
580 |
-# _configure_quantum_service() - Set config files for quantum service |
|
581 |
-# It is called when q-svc is enabled. |
|
582 |
-function _configure_quantum_service() { |
|
583 |
- Q_API_PASTE_FILE=$QUANTUM_CONF_DIR/api-paste.ini |
|
584 |
- Q_POLICY_FILE=$QUANTUM_CONF_DIR/policy.json |
|
585 |
- |
|
586 |
- cp $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE |
|
587 |
- cp $QUANTUM_DIR/etc/policy.json $Q_POLICY_FILE |
|
588 |
- |
|
589 |
- if is_service_enabled $DATABASE_BACKENDS; then |
|
590 |
- recreate_database $Q_DB_NAME utf8 |
|
591 |
- else |
|
592 |
- die $LINENO "A database must be enabled in order to use the $Q_PLUGIN Quantum plugin." |
|
593 |
- fi |
|
594 |
- |
|
595 |
- # Update either configuration file with plugin |
|
596 |
- iniset $QUANTUM_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS |
|
597 |
- |
|
598 |
- if [[ $Q_SERVICE_PLUGIN_CLASSES != '' ]]; then |
|
599 |
- iniset $QUANTUM_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES |
|
600 |
- fi |
|
601 |
- |
|
602 |
- iniset $QUANTUM_CONF DEFAULT verbose True |
|
603 |
- iniset $QUANTUM_CONF DEFAULT debug True |
|
604 |
- iniset $QUANTUM_CONF DEFAULT policy_file $Q_POLICY_FILE |
|
605 |
- iniset $QUANTUM_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP |
|
606 |
- |
|
607 |
- iniset $QUANTUM_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY |
|
608 |
- _quantum_setup_keystone $QUANTUM_CONF keystone_authtoken |
|
609 |
- |
|
610 |
- # Configure plugin |
|
611 |
- quantum_plugin_configure_service |
|
612 |
-} |
|
613 |
- |
|
614 |
-# Utility Functions |
|
615 |
-#------------------ |
|
616 |
- |
|
617 |
-# _quantum_setup_rootwrap() - configure Quantum's rootwrap |
|
618 |
-function _quantum_setup_rootwrap() { |
|
619 |
- if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then |
|
620 |
- return |
|
621 |
- fi |
|
622 |
- # Deploy new rootwrap filters files (owned by root). |
|
623 |
- # Wipe any existing ``rootwrap.d`` files first |
|
624 |
- Q_CONF_ROOTWRAP_D=$QUANTUM_CONF_DIR/rootwrap.d |
|
625 |
- if [[ -d $Q_CONF_ROOTWRAP_D ]]; then |
|
626 |
- sudo rm -rf $Q_CONF_ROOTWRAP_D |
|
627 |
- fi |
|
628 |
- # Deploy filters to ``$QUANTUM_CONF_DIR/rootwrap.d`` |
|
629 |
- mkdir -p -m 755 $Q_CONF_ROOTWRAP_D |
|
630 |
- cp -pr $QUANTUM_DIR/etc/quantum/rootwrap.d/* $Q_CONF_ROOTWRAP_D/ |
|
631 |
- sudo chown -R root:root $Q_CONF_ROOTWRAP_D |
|
632 |
- sudo chmod 644 $Q_CONF_ROOTWRAP_D/* |
|
633 |
- # Set up ``rootwrap.conf``, pointing to ``$QUANTUM_CONF_DIR/rootwrap.d`` |
|
634 |
- # location moved in newer versions, prefer new location |
|
635 |
- if test -r $QUANTUM_DIR/etc/quantum/rootwrap.conf; then |
|
636 |
- sudo cp -p $QUANTUM_DIR/etc/quantum/rootwrap.conf $Q_RR_CONF_FILE |
|
637 |
- else |
|
638 |
- sudo cp -p $QUANTUM_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE |
|
639 |
- fi |
|
640 |
- sudo sed -e "s:^filters_path=.*$:filters_path=$Q_CONF_ROOTWRAP_D:" -i $Q_RR_CONF_FILE |
|
641 |
- sudo chown root:root $Q_RR_CONF_FILE |
|
642 |
- sudo chmod 0644 $Q_RR_CONF_FILE |
|
643 |
- # Specify ``rootwrap.conf`` as first parameter to quantum-rootwrap |
|
644 |
- ROOTWRAP_SUDOER_CMD="$QUANTUM_ROOTWRAP $Q_RR_CONF_FILE *" |
|
645 |
- |
|
646 |
- # Set up the rootwrap sudoers for quantum |
|
647 |
- TEMPFILE=`mktemp` |
|
648 |
- echo "$USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE |
|
649 |
- chmod 0440 $TEMPFILE |
|
650 |
- sudo chown root:root $TEMPFILE |
|
651 |
- sudo mv $TEMPFILE /etc/sudoers.d/quantum-rootwrap |
|
652 |
- |
|
653 |
- # Update the root_helper |
|
654 |
- iniset $QUANTUM_CONF agent root_helper "$Q_RR_COMMAND" |
|
655 |
-} |
|
656 |
- |
|
657 |
-# Configures keystone integration for quantum service and agents |
|
658 |
-function _quantum_setup_keystone() { |
|
659 |
- local conf_file=$1 |
|
660 |
- local section=$2 |
|
661 |
- local use_auth_url=$3 |
|
662 |
- if [[ -n $use_auth_url ]]; then |
|
663 |
- iniset $conf_file $section auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_AUTH_HOST:$KEYSTONE_AUTH_PORT/v2.0" |
|
664 |
- else |
|
665 |
- iniset $conf_file $section auth_host $KEYSTONE_SERVICE_HOST |
|
666 |
- iniset $conf_file $section auth_port $KEYSTONE_AUTH_PORT |
|
667 |
- iniset $conf_file $section auth_protocol $KEYSTONE_SERVICE_PROTOCOL |
|
668 |
- fi |
|
669 |
- iniset $conf_file $section admin_tenant_name $SERVICE_TENANT_NAME |
|
670 |
- iniset $conf_file $section admin_user $Q_ADMIN_USERNAME |
|
671 |
- iniset $conf_file $section admin_password $SERVICE_PASSWORD |
|
672 |
- iniset $conf_file $section signing_dir $QUANTUM_AUTH_CACHE_DIR |
|
673 |
- # Create cache dir |
|
674 |
- sudo mkdir -p $QUANTUM_AUTH_CACHE_DIR |
|
675 |
- sudo chown $STACK_USER $QUANTUM_AUTH_CACHE_DIR |
|
676 |
- rm -f $QUANTUM_AUTH_CACHE_DIR/* |
|
677 |
-} |
|
678 |
- |
|
679 |
-function _quantum_setup_interface_driver() { |
|
680 |
- |
|
681 |
- # ovs_use_veth needs to be set before the plugin configuration |
|
682 |
- # occurs to allow plugins to override the setting. |
|
683 |
- iniset $1 DEFAULT ovs_use_veth $Q_OVS_USE_VETH |
|
684 |
- |
|
685 |
- quantum_plugin_setup_interface_driver $1 |
|
686 |
-} |
|
687 |
- |
|
688 |
-# Functions for Quantum Exercises |
|
689 |
-#-------------------------------- |
|
690 |
- |
|
691 |
-function delete_probe() { |
|
692 |
- local from_net="$1" |
|
693 |
- net_id=`_get_net_id $from_net` |
|
694 |
- probe_id=`quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'` |
|
695 |
- quantum-debug --os-tenant-name admin --os-username admin probe-delete $probe_id |
|
696 |
-} |
|
697 |
- |
|
698 |
-function setup_quantum_debug() { |
|
699 |
- if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then |
|
700 |
- public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME` |
|
701 |
- quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $public_net_id |
|
702 |
- private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME` |
|
703 |
- quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $private_net_id |
|
704 |
- fi |
|
705 |
-} |
|
706 |
- |
|
707 |
-function teardown_quantum_debug() { |
|
708 |
- delete_probe $PUBLIC_NETWORK_NAME |
|
709 |
- delete_probe $PRIVATE_NETWORK_NAME |
|
710 |
-} |
|
711 |
- |
|
712 |
-function _get_net_id() { |
|
713 |
- quantum --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}' |
|
714 |
-} |
|
715 |
- |
|
716 |
-function _get_probe_cmd_prefix() { |
|
717 |
- local from_net="$1" |
|
718 |
- net_id=`_get_net_id $from_net` |
|
719 |
- probe_id=`quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}' | head -n 1` |
|
720 |
- echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id" |
|
721 |
-} |
|
722 |
- |
|
723 |
-function _ping_check_quantum() { |
|
724 |
- local from_net=$1 |
|
725 |
- local ip=$2 |
|
726 |
- local timeout_sec=$3 |
|
727 |
- local expected=${4:-"True"} |
|
728 |
- local check_command="" |
|
729 |
- probe_cmd=`_get_probe_cmd_prefix $from_net` |
|
730 |
- if [[ "$expected" = "True" ]]; then |
|
731 |
- check_command="while ! $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done" |
|
732 |
- else |
|
733 |
- check_command="while $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done" |
|
734 |
- fi |
|
735 |
- if ! timeout $timeout_sec sh -c "$check_command"; then |
|
736 |
- if [[ "$expected" = "True" ]]; then |
|
737 |
- die $LINENO "[Fail] Couldn't ping server" |
|
738 |
- else |
|
739 |
- die $LINENO "[Fail] Could ping server" |
|
740 |
- fi |
|
741 |
- fi |
|
742 |
-} |
|
743 |
- |
|
744 |
-# ssh check |
|
745 |
-function _ssh_check_quantum() { |
|
746 |
- local from_net=$1 |
|
747 |
- local key_file=$2 |
|
748 |
- local ip=$3 |
|
749 |
- local user=$4 |
|
750 |
- local timeout_sec=$5 |
|
751 |
- local probe_cmd = "" |
|
752 |
- probe_cmd=`_get_probe_cmd_prefix $from_net` |
|
753 |
- if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success; do sleep 1; done"; then |
|
754 |
- die $LINENO "server didn't become ssh-able!" |
|
755 |
- fi |
|
756 |
-} |
|
757 |
- |
|
758 |
-# Quantum 3rd party programs |
|
759 |
-#--------------------------- |
|
760 |
- |
|
761 |
-# please refer to ``lib/quantum_thirdparty/README.md`` for details |
|
762 |
-QUANTUM_THIRD_PARTIES="" |
|
763 |
-for f in $TOP_DIR/lib/quantum_thirdparty/*; do |
|
764 |
- third_party=$(basename $f) |
|
765 |
- if is_service_enabled $third_party; then |
|
766 |
- source $TOP_DIR/lib/quantum_thirdparty/$third_party |
|
767 |
- QUANTUM_THIRD_PARTIES="$QUANTUM_THIRD_PARTIES,$third_party" |
|
768 |
- fi |
|
769 |
-done |
|
770 |
- |
|
771 |
-function _quantum_third_party_do() { |
|
772 |
- for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do |
|
773 |
- ${1}_${third_party} |
|
774 |
- done |
|
775 |
-} |
|
776 |
- |
|
777 |
-# configure_quantum_third_party() - Set config files, create data dirs, etc |
|
778 |
-function configure_quantum_third_party() { |
|
779 |
- _quantum_third_party_do configure |
|
780 |
-} |
|
781 |
- |
|
782 |
-# init_quantum_third_party() - Initialize databases, etc. |
|
783 |
-function init_quantum_third_party() { |
|
784 |
- _quantum_third_party_do init |
|
785 |
-} |
|
786 |
- |
|
787 |
-# install_quantum_third_party() - Collect source and prepare |
|
788 |
-function install_quantum_third_party() { |
|
789 |
- _quantum_third_party_do install |
|
790 |
-} |
|
791 |
- |
|
792 |
-# start_quantum_third_party() - Start running processes, including screen |
|
793 |
-function start_quantum_third_party() { |
|
794 |
- _quantum_third_party_do start |
|
795 |
-} |
|
796 |
- |
|
797 |
-# stop_quantum_third_party - Stop running processes (non-screen) |
|
798 |
-function stop_quantum_third_party() { |
|
799 |
- _quantum_third_party_do stop |
|
800 |
-} |
|
801 |
- |
|
802 |
- |
|
803 |
-# Restore xtrace |
|
804 |
-$XTRACE |
|
805 |
- |
|
806 |
-# Local variables: |
|
807 |
-# mode: shell-script |
|
808 |
-# End: |
809 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,38 +0,0 @@ |
1 |
-Quantum plugin specific files |
|
2 |
-============================= |
|
3 |
-Quantum plugins require plugin specific behavior. |
|
4 |
-The files under the directory, ``lib/quantum_plugins/``, will be used |
|
5 |
-when their service is enabled. |
|
6 |
-Each plugin has ``lib/quantum_plugins/$Q_PLUGIN`` and define the following |
|
7 |
-functions. |
|
8 |
-Plugin specific configuration variables should be in this file. |
|
9 |
- |
|
10 |
-* filename: ``$Q_PLUGIN`` |
|
11 |
- * The corresponding file name MUST be the same to plugin name ``$Q_PLUGIN``. |
|
12 |
- Plugin specific configuration variables should be in this file. |
|
13 |
- |
|
14 |
-functions |
|
15 |
-``lib/quantum`` calls the following functions when the ``$Q_PLUGIN`` is enabled |
|
16 |
- |
|
17 |
-* ``quantum_plugin_create_nova_conf`` : |
|
18 |
- set ``NOVA_VIF_DRIVER`` and optionally set options in nova_conf |
|
19 |
- e.g. |
|
20 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
21 |
-* ``quantum_plugin_install_agent_packages`` : |
|
22 |
- install packages that is specific to plugin agent |
|
23 |
- e.g. |
|
24 |
- install_package bridge-utils |
|
25 |
-* ``quantum_plugin_configure_common`` : |
|
26 |
- set plugin-specific variables, ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``, |
|
27 |
- ``Q_DB_NAME``, ``Q_PLUGIN_CLASS`` |
|
28 |
-* ``quantum_plugin_configure_debug_command`` |
|
29 |
-* ``quantum_plugin_configure_dhcp_agent`` |
|
30 |
-* ``quantum_plugin_configure_l3_agent`` |
|
31 |
-* ``quantum_plugin_configure_plugin_agent`` |
|
32 |
-* ``quantum_plugin_configure_service`` |
|
33 |
-* ``quantum_plugin_setup_interface_driver`` |
|
34 |
-* ``has_quantum_plugin_security_group``: |
|
35 |
- return 0 if the plugin support quantum security group otherwise return 1 |
|
36 |
-* ``quantum_plugin_check_adv_test_requirements``: |
|
37 |
- return 0 if requirements are satisfied otherwise return 1 |
38 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,74 +0,0 @@ |
1 |
-# Quantum Big Switch/FloodLight plugin |
|
2 |
-# ------------------------------------ |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
9 |
-source $TOP_DIR/lib/quantum_thirdparty/bigswitch_floodlight # for third party service specific configuration values |
|
10 |
- |
|
11 |
-function quantum_plugin_create_nova_conf() { |
|
12 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
13 |
-} |
|
14 |
- |
|
15 |
-function quantum_plugin_install_agent_packages() { |
|
16 |
- _quantum_ovs_base_install_agent_packages |
|
17 |
-} |
|
18 |
- |
|
19 |
-function quantum_plugin_configure_common() { |
|
20 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/bigswitch |
|
21 |
- Q_PLUGIN_CONF_FILENAME=restproxy.ini |
|
22 |
- Q_DB_NAME="restproxy_quantum" |
|
23 |
- Q_PLUGIN_CLASS="quantum.plugins.bigswitch.plugin.QuantumRestProxyV2" |
|
24 |
- BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80} |
|
25 |
- BS_FL_CONTROLLER_TIMEOUT=${BS_FL_CONTROLLER_TIMEOUT:-10} |
|
26 |
-} |
|
27 |
- |
|
28 |
-function quantum_plugin_configure_debug_command() { |
|
29 |
- _quantum_ovs_base_configure_debug_command |
|
30 |
-} |
|
31 |
- |
|
32 |
-function quantum_plugin_configure_dhcp_agent() { |
|
33 |
- : |
|
34 |
-} |
|
35 |
- |
|
36 |
-function quantum_plugin_configure_l3_agent() { |
|
37 |
- _quantum_ovs_base_configure_l3_agent |
|
38 |
-} |
|
39 |
- |
|
40 |
-function quantum_plugin_configure_plugin_agent() { |
|
41 |
- : |
|
42 |
-} |
|
43 |
- |
|
44 |
-function quantum_plugin_configure_service() { |
|
45 |
- iniset /$Q_PLUGIN_CONF_FILE restproxy servers $BS_FL_CONTROLLERS_PORT |
|
46 |
- iniset /$Q_PLUGIN_CONF_FILE restproxy servertimeout $BS_FL_CONTROLLER_TIMEOUT |
|
47 |
- if [ "$BS_FL_VIF_DRIVER" = "ivs" ] |
|
48 |
- then |
|
49 |
- iniset /$Q_PLUGIN_CONF_FILE nova vif_type ivs |
|
50 |
- fi |
|
51 |
-} |
|
52 |
- |
|
53 |
-function quantum_plugin_setup_interface_driver() { |
|
54 |
- local conf_file=$1 |
|
55 |
- if [ "$BS_FL_VIF_DRIVER" = "ivs" ] |
|
56 |
- then |
|
57 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.IVSInterfaceDriver |
|
58 |
- else |
|
59 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
60 |
- fi |
|
61 |
-} |
|
62 |
- |
|
63 |
- |
|
64 |
-function has_quantum_plugin_security_group() { |
|
65 |
- # 1 means False here |
|
66 |
- return 1 |
|
67 |
-} |
|
68 |
- |
|
69 |
-function quantum_plugin_check_adv_test_requirements() { |
|
70 |
- is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
71 |
-} |
|
72 |
- |
|
73 |
-# Restore xtrace |
|
74 |
-$MY_XTRACE |
75 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,59 +0,0 @@ |
1 |
-# Brocade Quantum Plugin |
|
2 |
-# ---------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-BRCD_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-function is_quantum_ovs_base_plugin() { |
|
9 |
- return 1 |
|
10 |
-} |
|
11 |
- |
|
12 |
-function quantum_plugin_create_nova_conf() { |
|
13 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
14 |
-} |
|
15 |
- |
|
16 |
-function quantum_plugin_install_agent_packages() { |
|
17 |
- install_package bridge-utils |
|
18 |
-} |
|
19 |
- |
|
20 |
-function quantum_plugin_configure_common() { |
|
21 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/brocade |
|
22 |
- Q_PLUGIN_CONF_FILENAME=brocade.ini |
|
23 |
- Q_DB_NAME="brcd_quantum" |
|
24 |
- Q_PLUGIN_CLASS="quantum.plugins.brocade.QuantumPlugin.BrocadePluginV2" |
|
25 |
-} |
|
26 |
- |
|
27 |
-function quantum_plugin_configure_debug_command() { |
|
28 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge |
|
29 |
-} |
|
30 |
- |
|
31 |
-function quantum_plugin_configure_dhcp_agent() { |
|
32 |
- iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager quantum.agent.dhcp_agent.DhcpAgentWithStateReport |
|
33 |
-} |
|
34 |
- |
|
35 |
-function quantum_plugin_configure_l3_agent() { |
|
36 |
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge |
|
37 |
- iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager quantum.agent.l3_agent.L3NATAgentWithStateReport |
|
38 |
-} |
|
39 |
- |
|
40 |
-function quantum_plugin_configure_plugin_agent() { |
|
41 |
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent" |
|
42 |
-} |
|
43 |
- |
|
44 |
-function quantum_plugin_setup_interface_driver() { |
|
45 |
- local conf_file=$1 |
|
46 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
|
47 |
-} |
|
48 |
- |
|
49 |
-function has_quantum_plugin_security_group() { |
|
50 |
- # 0 means True here |
|
51 |
- return 0 |
|
52 |
-} |
|
53 |
- |
|
54 |
-function quantum_plugin_check_adv_test_requirements() { |
|
55 |
- is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
56 |
-} |
|
57 |
- |
|
58 |
-# Restore xtrace |
|
59 |
-$BRCD_XTRACE |
60 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,327 +0,0 @@ |
1 |
-# Quantum Cisco plugin |
|
2 |
-# --------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-# Scecify the VSM parameters |
|
9 |
-Q_CISCO_PLUGIN_VSM_IP=${Q_CISCO_PLUGIN_VSM_IP:-} |
|
10 |
-# Specify the VSM username |
|
11 |
-Q_CISCO_PLUGIN_VSM_USERNAME=${Q_CISCO_PLUGIN_VSM_USERNAME:-admin} |
|
12 |
-# Specify the VSM passward for above username |
|
13 |
-Q_CISCO_PLUGIN_VSM_PASSWORD=${Q_CISCO_PLUGIN_VSM_PASSWORD:-} |
|
14 |
-# Specify the uVEM integration bridge name |
|
15 |
-Q_CISCO_PLUGIN_INTEGRATION_BRIDGE=${Q_CISCO_PLUGIN_INTEGRATION_BRIDGE:-br-int} |
|
16 |
-# Specify if tunneling is enabled |
|
17 |
-Q_CISCO_PLUGIN_ENABLE_TUNNELING=${Q_CISCO_PLUGIN_ENABLE_TUNNELING:-True} |
|
18 |
-# Specify the VXLAN range |
|
19 |
-Q_CISCO_PLUGIN_VXLAN_ID_RANGES=${Q_CISCO_PLUGIN_VXLAN_ID_RANGES:-5000:10000} |
|
20 |
-# Specify the VLAN range |
|
21 |
-Q_CISCO_PLUGIN_VLAN_RANGES=${Q_CISCO_PLUGIN_VLAN_RANGES:-vlan:1:4094} |
|
22 |
- |
|
23 |
-# Specify ncclient package information |
|
24 |
-NCCLIENT_DIR=$DEST/ncclient |
|
25 |
-NCCLIENT_VERSION=${NCCLIENT_VERSION:-0.3.1} |
|
26 |
-NCCLIENT_REPO=${NCCLIENT_REPO:-${GIT_BASE}/CiscoSystems/ncclient.git} |
|
27 |
-NCCLIENT_BRANCH=${NCCLIENT_BRANCH:-master} |
|
28 |
- |
|
29 |
-# This routine put a prefix on an existing function name |
|
30 |
-function _prefix_function() { |
|
31 |
- declare -F $1 > /dev/null || die "$1 doesn't exist" |
|
32 |
- eval "$(echo "${2}_${1}()"; declare -f ${1} | tail -n +2)" |
|
33 |
-} |
|
34 |
- |
|
35 |
-function _has_ovs_subplugin() { |
|
36 |
- local subplugin |
|
37 |
- for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do |
|
38 |
- if [[ "$subplugin" == "openvswitch" ]]; then |
|
39 |
- return 0 |
|
40 |
- fi |
|
41 |
- done |
|
42 |
- return 1 |
|
43 |
-} |
|
44 |
- |
|
45 |
-function _has_nexus_subplugin() { |
|
46 |
- local subplugin |
|
47 |
- for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do |
|
48 |
- if [[ "$subplugin" == "nexus" ]]; then |
|
49 |
- return 0 |
|
50 |
- fi |
|
51 |
- done |
|
52 |
- return 1 |
|
53 |
-} |
|
54 |
- |
|
55 |
-function _has_n1kv_subplugin() { |
|
56 |
- local subplugin |
|
57 |
- for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do |
|
58 |
- if [[ "$subplugin" == "n1kv" ]]; then |
|
59 |
- return 0 |
|
60 |
- fi |
|
61 |
- done |
|
62 |
- return 1 |
|
63 |
-} |
|
64 |
- |
|
65 |
-# This routine populates the cisco config file with the information for |
|
66 |
-# a particular nexus switch |
|
67 |
-function _config_switch() { |
|
68 |
- local cisco_cfg_file=$1 |
|
69 |
- local switch_ip=$2 |
|
70 |
- local username=$3 |
|
71 |
- local password=$4 |
|
72 |
- local ssh_port=$5 |
|
73 |
- shift 5 |
|
74 |
- |
|
75 |
- local section="NEXUS_SWITCH:$switch_ip" |
|
76 |
- iniset $cisco_cfg_file $section username $username |
|
77 |
- iniset $cisco_cfg_file $section password $password |
|
78 |
- iniset $cisco_cfg_file $section ssh_port $ssh_port |
|
79 |
- |
|
80 |
- while [[ ${#@} != 0 ]]; do |
|
81 |
- iniset $cisco_cfg_file $section $1 $2 |
|
82 |
- shift 2 |
|
83 |
- done |
|
84 |
-} |
|
85 |
- |
|
86 |
-# Prefix openvswitch plugin routines with "ovs" in order to differentiate from |
|
87 |
-# cisco plugin routines. This means, ovs plugin routines will coexist with cisco |
|
88 |
-# plugin routines in this script. |
|
89 |
-source $TOP_DIR/lib/quantum_plugins/openvswitch |
|
90 |
-_prefix_function quantum_plugin_create_nova_conf ovs |
|
91 |
-_prefix_function quantum_plugin_install_agent_packages ovs |
|
92 |
-_prefix_function quantum_plugin_configure_common ovs |
|
93 |
-_prefix_function quantum_plugin_configure_debug_command ovs |
|
94 |
-_prefix_function quantum_plugin_configure_dhcp_agent ovs |
|
95 |
-_prefix_function quantum_plugin_configure_l3_agent ovs |
|
96 |
-_prefix_function quantum_plugin_configure_plugin_agent ovs |
|
97 |
-_prefix_function quantum_plugin_configure_service ovs |
|
98 |
-_prefix_function quantum_plugin_setup_interface_driver ovs |
|
99 |
-_prefix_function has_quantum_plugin_security_group ovs |
|
100 |
- |
|
101 |
-# Check the version of the installed ncclient package |
|
102 |
-function check_ncclient_version() { |
|
103 |
-python << EOF |
|
104 |
-version = '$NCCLIENT_VERSION' |
|
105 |
-import sys |
|
106 |
-try: |
|
107 |
- import pkg_resources |
|
108 |
- import ncclient |
|
109 |
- module_version = pkg_resources.get_distribution('ncclient').version |
|
110 |
- if version != module_version: |
|
111 |
- sys.exit(1) |
|
112 |
-except: |
|
113 |
- sys.exit(1) |
|
114 |
-EOF |
|
115 |
-} |
|
116 |
- |
|
117 |
-# Install the ncclient package |
|
118 |
-function install_ncclient() { |
|
119 |
- git_clone $NCCLIENT_REPO $NCCLIENT_DIR $NCCLIENT_BRANCH |
|
120 |
- (cd $NCCLIENT_DIR; sudo python setup.py install) |
|
121 |
-} |
|
122 |
- |
|
123 |
-# Check if the required version of ncclient has been installed |
|
124 |
-function is_ncclient_installed() { |
|
125 |
- # Check if the Cisco ncclient repository exists |
|
126 |
- if [[ -d $NCCLIENT_DIR ]]; then |
|
127 |
- remotes=$(cd $NCCLIENT_DIR; git remote -v | grep fetch | awk '{ print $2}') |
|
128 |
- for remote in $remotes; do |
|
129 |
- if [[ $remote == $NCCLIENT_REPO ]]; then |
|
130 |
- break; |
|
131 |
- fi |
|
132 |
- done |
|
133 |
- if [[ $remote != $NCCLIENT_REPO ]]; then |
|
134 |
- return 1 |
|
135 |
- fi |
|
136 |
- else |
|
137 |
- return 1 |
|
138 |
- fi |
|
139 |
- |
|
140 |
- # Check if the ncclient is installed with the right version |
|
141 |
- if ! check_ncclient_version; then |
|
142 |
- return 1 |
|
143 |
- fi |
|
144 |
- return 0 |
|
145 |
-} |
|
146 |
- |
|
147 |
-function has_quantum_plugin_security_group() { |
|
148 |
- if _has_ovs_subplugin; then |
|
149 |
- ovs_has_quantum_plugin_security_group |
|
150 |
- else |
|
151 |
- return 1 |
|
152 |
- fi |
|
153 |
-} |
|
154 |
- |
|
155 |
-function is_quantum_ovs_base_plugin() { |
|
156 |
- # Cisco uses OVS if openvswitch subplugin is deployed |
|
157 |
- _has_ovs_subplugin |
|
158 |
- return |
|
159 |
-} |
|
160 |
- |
|
161 |
-# populate required nova configuration parameters |
|
162 |
-function quantum_plugin_create_nova_conf() { |
|
163 |
- if _has_ovs_subplugin; then |
|
164 |
- ovs_quantum_plugin_create_nova_conf |
|
165 |
- else |
|
166 |
- _quantum_ovs_base_configure_nova_vif_driver |
|
167 |
- fi |
|
168 |
-} |
|
169 |
- |
|
170 |
-function quantum_plugin_install_agent_packages() { |
|
171 |
- # Cisco plugin uses openvswitch to operate in one of its configurations |
|
172 |
- ovs_quantum_plugin_install_agent_packages |
|
173 |
-} |
|
174 |
- |
|
175 |
-# Configure common parameters |
|
176 |
-function quantum_plugin_configure_common() { |
|
177 |
- # setup default subplugins |
|
178 |
- if [ ! -v Q_CISCO_PLUGIN_SUBPLUGINS ]; then |
|
179 |
- declare -ga Q_CISCO_PLUGIN_SUBPLUGINS |
|
180 |
- Q_CISCO_PLUGIN_SUBPLUGINS=(openvswitch nexus) |
|
181 |
- fi |
|
182 |
- if _has_ovs_subplugin; then |
|
183 |
- ovs_quantum_plugin_configure_common |
|
184 |
- Q_PLUGIN_EXTRA_CONF_PATH=etc/quantum/plugins/cisco |
|
185 |
- Q_PLUGIN_EXTRA_CONF_FILES=(cisco_plugins.ini) |
|
186 |
- else |
|
187 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/cisco |
|
188 |
- Q_PLUGIN_CONF_FILENAME=cisco_plugins.ini |
|
189 |
- fi |
|
190 |
- Q_PLUGIN_CLASS="quantum.plugins.cisco.network_plugin.PluginV2" |
|
191 |
- Q_DB_NAME=cisco_quantum |
|
192 |
-} |
|
193 |
- |
|
194 |
-function quantum_plugin_configure_debug_command() { |
|
195 |
- if _has_ovs_subplugin; then |
|
196 |
- ovs_quantum_plugin_configure_debug_command |
|
197 |
- fi |
|
198 |
-} |
|
199 |
- |
|
200 |
-function quantum_plugin_configure_dhcp_agent() { |
|
201 |
- iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager quantum.agent.dhcp_agent.DhcpAgentWithStateReport |
|
202 |
-} |
|
203 |
- |
|
204 |
-function quantum_plugin_configure_l3_agent() { |
|
205 |
- if _has_ovs_subplugin; then |
|
206 |
- ovs_quantum_plugin_configure_l3_agent |
|
207 |
- fi |
|
208 |
-} |
|
209 |
- |
|
210 |
-function _configure_nexus_subplugin() { |
|
211 |
- local cisco_cfg_file=$1 |
|
212 |
- |
|
213 |
- # Install a known compatible ncclient from the Cisco repository if necessary |
|
214 |
- if ! is_ncclient_installed; then |
|
215 |
- # Preserve the two global variables |
|
216 |
- local offline=$OFFLINE |
|
217 |
- local reclone=$RECLONE |
|
218 |
- # Change their values to allow installation |
|
219 |
- OFFLINE=False |
|
220 |
- RECLONE=yes |
|
221 |
- install_ncclient |
|
222 |
- # Restore their values |
|
223 |
- OFFLINE=$offline |
|
224 |
- RECLONE=$reclone |
|
225 |
- fi |
|
226 |
- |
|
227 |
- # Setup default nexus switch information |
|
228 |
- if [ ! -v Q_CISCO_PLUGIN_SWITCH_INFO ]; then |
|
229 |
- declare -A Q_CISCO_PLUGIN_SWITCH_INFO |
|
230 |
- HOST_NAME=$(hostname) |
|
231 |
- Q_CISCO_PLUGIN_SWITCH_INFO=([1.1.1.1]=stack:stack:22:${HOST_NAME}:1/10) |
|
232 |
- else |
|
233 |
- iniset $cisco_cfg_file CISCO nexus_driver quantum.plugins.cisco.nexus.cisco_nexus_network_driver_v2.CiscoNEXUSDriver |
|
234 |
- fi |
|
235 |
- |
|
236 |
- # Setup the switch configurations |
|
237 |
- local nswitch |
|
238 |
- local sw_info |
|
239 |
- local segment |
|
240 |
- local sw_info_array |
|
241 |
- declare -i count=0 |
|
242 |
- for nswitch in ${!Q_CISCO_PLUGIN_SWITCH_INFO[@]}; do |
|
243 |
- sw_info=${Q_CISCO_PLUGIN_SWITCH_INFO[$nswitch]} |
|
244 |
- sw_info_array=${sw_info//:/ } |
|
245 |
- sw_info_array=( $sw_info_array ) |
|
246 |
- count=${#sw_info_array[@]} |
|
247 |
- if [[ $count < 5 || $(( ($count-3) % 2 )) != 0 ]]; then |
|
248 |
- die $LINENO "Incorrect switch configuration: ${Q_CISCO_PLUGIN_SWITCH_INFO[$nswitch]}" |
|
249 |
- fi |
|
250 |
- _config_switch $cisco_cfg_file $nswitch ${sw_info_array[@]} |
|
251 |
- done |
|
252 |
-} |
|
253 |
- |
|
254 |
-# Configure n1kv plugin |
|
255 |
-function _configure_n1kv_subplugin() { |
|
256 |
- local cisco_cfg_file=$1 |
|
257 |
- |
|
258 |
- # populate the cisco plugin cfg file with the VSM information |
|
259 |
- echo "Configuring n1kv in $cisco_cfg_file-- $Q_CISCO_PLUGIN_VSM_IP $Q_CISCO_PLUGIN_VSM_USERNAME $Q_CISCO_PLUGIN_VSM_PASSWORD" |
|
260 |
- iniset $cisco_cfg_file N1KV:$Q_CISCO_PLUGIN_VSM_IP username $Q_CISCO_PLUGIN_VSM_USERNAME |
|
261 |
- iniset $cisco_cfg_file N1KV:$Q_CISCO_PLUGIN_VSM_IP password $Q_CISCO_PLUGIN_VSM_PASSWORD |
|
262 |
- |
|
263 |
- iniset $cisco_cfg_file CISCO_N1K integration_bridge $Q_CISCO_PLUGIN_INTEGRATION_BRIDGE |
|
264 |
- iniset $cisco_cfg_file CISCO_N1K enable_tunneling $Q_CISCO_PLUGIN_ENABLE_TUNNELING |
|
265 |
- iniset $cisco_cfg_file CISCO_N1K vxlan_id_ranges $Q_CISCO_PLUGIN_VXLAN_ID_RANGES |
|
266 |
- iniset $cisco_cfg_file CISCO_N1K network_vlan_ranges $Q_CISCO_PLUGIN_VLAN_RANGES |
|
267 |
- |
|
268 |
- # Setup the integration bridge by calling the ovs_base |
|
269 |
- OVS_BRIDGE=$Q_CISCO_PLUGIN_INTEGRATION_BRIDGE |
|
270 |
- _quantum_ovs_base_setup_bridge $OVS_BRIDGE |
|
271 |
-} |
|
272 |
- |
|
273 |
-function quantum_plugin_configure_plugin_agent() { |
|
274 |
- if _has_ovs_subplugin; then |
|
275 |
- ovs_quantum_plugin_configure_plugin_agent |
|
276 |
- fi |
|
277 |
-} |
|
278 |
- |
|
279 |
-function quantum_plugin_configure_service() { |
|
280 |
- local subplugin |
|
281 |
- local cisco_cfg_file |
|
282 |
- |
|
283 |
- if _has_ovs_subplugin; then |
|
284 |
- ovs_quantum_plugin_configure_service |
|
285 |
- cisco_cfg_file=/${Q_PLUGIN_EXTRA_CONF_FILES[0]} |
|
286 |
- else |
|
287 |
- cisco_cfg_file=/$Q_PLUGIN_CONF_FILE |
|
288 |
- fi |
|
289 |
- |
|
290 |
- # Setup the [CISCO_PLUGINS] section |
|
291 |
- if [[ ${#Q_CISCO_PLUGIN_SUBPLUGINS[@]} > 2 ]]; then |
|
292 |
- die $LINENO "At most two subplugins are supported." |
|
293 |
- fi |
|
294 |
- |
|
295 |
- if _has_ovs_subplugin && _has_n1kv_subplugin; then |
|
296 |
- die $LINENO "OVS subplugin and n1kv subplugin cannot coexist" |
|
297 |
- fi |
|
298 |
- |
|
299 |
- # Setup the subplugins |
|
300 |
- inicomment $cisco_cfg_file CISCO_PLUGINS nexus_plugin |
|
301 |
- inicomment $cisco_cfg_file CISCO_PLUGINS vswitch_plugin |
|
302 |
- inicomment $cisco_cfg_file CISCO_TEST host |
|
303 |
- for subplugin in ${Q_CISCO_PLUGIN_SUBPLUGINS[@]}; do |
|
304 |
- case $subplugin in |
|
305 |
- nexus) iniset $cisco_cfg_file CISCO_PLUGINS nexus_plugin quantum.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin;; |
|
306 |
- openvswitch) iniset $cisco_cfg_file CISCO_PLUGINS vswitch_plugin quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2;; |
|
307 |
- n1kv) iniset $cisco_cfg_file CISCO_PLUGINS vswitch_plugin quantum.plugins.cisco.n1kv.n1kv_quantum_plugin.N1kvQuantumPluginV2;; |
|
308 |
- *) die $LINENO "Unsupported cisco subplugin: $subplugin";; |
|
309 |
- esac |
|
310 |
- done |
|
311 |
- |
|
312 |
- if _has_nexus_subplugin; then |
|
313 |
- _configure_nexus_subplugin $cisco_cfg_file |
|
314 |
- fi |
|
315 |
- |
|
316 |
- if _has_n1kv_subplugin; then |
|
317 |
- _configure_n1kv_subplugin $cisco_cfg_file |
|
318 |
- fi |
|
319 |
-} |
|
320 |
- |
|
321 |
-function quantum_plugin_setup_interface_driver() { |
|
322 |
- local conf_file=$1 |
|
323 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
324 |
-} |
|
325 |
- |
|
326 |
-# Restore xtrace |
|
327 |
-$MY_XTRACE |
328 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,54 +0,0 @@ |
1 |
-# Quantum Linux Bridge plugin |
|
2 |
-# --------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-function quantum_plugin_configure_common() { |
|
9 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/linuxbridge |
|
10 |
- Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini |
|
11 |
- Q_DB_NAME="quantum_linux_bridge" |
|
12 |
- Q_PLUGIN_CLASS="quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2" |
|
13 |
-} |
|
14 |
- |
|
15 |
-function quantum_plugin_configure_service() { |
|
16 |
- if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
17 |
- iniset /$Q_PLUGIN_CONF_FILE vlans tenant_network_type vlan |
|
18 |
- else |
|
19 |
- echo "WARNING - The linuxbridge plugin is using local tenant networks, with no connectivity between hosts." |
|
20 |
- fi |
|
21 |
- |
|
22 |
- # Override ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` |
|
23 |
- # for more complex physical network configurations. |
|
24 |
- if [[ "$LB_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
25 |
- LB_VLAN_RANGES=$PHYSICAL_NETWORK |
|
26 |
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
27 |
- LB_VLAN_RANGES=$LB_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
28 |
- fi |
|
29 |
- fi |
|
30 |
- if [[ "$LB_VLAN_RANGES" != "" ]]; then |
|
31 |
- iniset /$Q_PLUGIN_CONF_FILE vlans network_vlan_ranges $LB_VLAN_RANGES |
|
32 |
- fi |
|
33 |
- if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
34 |
- iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver quantum.agent.linux.iptables_firewall.IptablesFirewallDriver |
|
35 |
- else |
|
36 |
- iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver quantum.agent.firewall.NoopFirewallDriver |
|
37 |
- fi |
|
38 |
- |
|
39 |
- # Define extra "LINUX_BRIDGE" configuration options when q-svc is configured by defining |
|
40 |
- # the array ``Q_SRV_EXTRA_OPTS``. |
|
41 |
- # For Example: ``Q_SRV_EXTRA_OPTS=(foo=true bar=2)`` |
|
42 |
- for I in "${Q_SRV_EXTRA_OPTS[@]}"; do |
|
43 |
- # Replace the first '=' with ' ' for iniset syntax |
|
44 |
- iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ } |
|
45 |
- done |
|
46 |
-} |
|
47 |
- |
|
48 |
-function has_quantum_plugin_security_group() { |
|
49 |
- # 0 means True here |
|
50 |
- return 0 |
|
51 |
-} |
|
52 |
- |
|
53 |
-# Restore xtrace |
|
54 |
-$MY_XTRACE |
55 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,76 +0,0 @@ |
1 |
-# Quantum Linux Bridge L2 agent |
|
2 |
-# ----------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-PLUGIN_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-function is_quantum_ovs_base_plugin() { |
|
9 |
- # linuxbridge doesn't use OVS |
|
10 |
- return 1 |
|
11 |
-} |
|
12 |
- |
|
13 |
-function quantum_plugin_create_nova_conf() { |
|
14 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
15 |
-} |
|
16 |
- |
|
17 |
-function quantum_plugin_install_agent_packages() { |
|
18 |
- install_package bridge-utils |
|
19 |
-} |
|
20 |
- |
|
21 |
-function quantum_plugin_configure_debug_command() { |
|
22 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge |
|
23 |
-} |
|
24 |
- |
|
25 |
-function quantum_plugin_configure_dhcp_agent() { |
|
26 |
- iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager quantum.agent.dhcp_agent.DhcpAgentWithStateReport |
|
27 |
-} |
|
28 |
- |
|
29 |
-function quantum_plugin_configure_l3_agent() { |
|
30 |
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge |
|
31 |
- iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager quantum.agent.l3_agent.L3NATAgentWithStateReport |
|
32 |
-} |
|
33 |
- |
|
34 |
-function quantum_plugin_configure_plugin_agent() { |
|
35 |
- # Setup physical network interface mappings. Override |
|
36 |
- # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more |
|
37 |
- # complex physical network configurations. |
|
38 |
- if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then |
|
39 |
- LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE |
|
40 |
- fi |
|
41 |
- if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then |
|
42 |
- iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS |
|
43 |
- fi |
|
44 |
- if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
45 |
- iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver quantum.agent.linux.iptables_firewall.IptablesFirewallDriver |
|
46 |
- else |
|
47 |
- iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver quantum.agent.firewall.NoopFirewallDriver |
|
48 |
- fi |
|
49 |
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent" |
|
50 |
- # Define extra "AGENT" configuration options when q-agt is configured by defining |
|
51 |
- # the array ``Q_AGENT_EXTRA_AGENT_OPTS``. |
|
52 |
- # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)`` |
|
53 |
- for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do |
|
54 |
- # Replace the first '=' with ' ' for iniset syntax |
|
55 |
- iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ } |
|
56 |
- done |
|
57 |
- # Define extra "LINUX_BRIDGE" configuration options when q-agt is configured by defining |
|
58 |
- # the array ``Q_AGENT_EXTRA_SRV_OPTS``. |
|
59 |
- # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)`` |
|
60 |
- for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do |
|
61 |
- # Replace the first '=' with ' ' for iniset syntax |
|
62 |
- iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ } |
|
63 |
- done |
|
64 |
-} |
|
65 |
- |
|
66 |
-function quantum_plugin_setup_interface_driver() { |
|
67 |
- local conf_file=$1 |
|
68 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver |
|
69 |
-} |
|
70 |
- |
|
71 |
-function quantum_plugin_check_adv_test_requirements() { |
|
72 |
- is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
73 |
-} |
|
74 |
- |
|
75 |
-# Restore xtrace |
|
76 |
-$PLUGIN_XTRACE |
77 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,62 +0,0 @@ |
1 |
-# Quantum Modular Layer 2 plugin |
|
2 |
-# ------------------------------ |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-# Default openvswitch L2 agent |
|
9 |
-Q_AGENT=${Q_AGENT:-openvswitch} |
|
10 |
-source $TOP_DIR/lib/quantum_plugins/${Q_AGENT}_agent |
|
11 |
- |
|
12 |
-function quantum_plugin_configure_common() { |
|
13 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ml2 |
|
14 |
- Q_PLUGIN_CONF_FILENAME=ml2_conf.ini |
|
15 |
- Q_DB_NAME="quantum_ml2" |
|
16 |
- Q_PLUGIN_CLASS="quantum.plugins.ml2.plugin.Ml2Plugin" |
|
17 |
-} |
|
18 |
- |
|
19 |
-function quantum_plugin_configure_service() { |
|
20 |
- if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then |
|
21 |
- iniset /$Q_PLUGIN_CONF_FILE ml2 tenant_network_types gre |
|
22 |
- iniset /$Q_PLUGIN_CONF_FILE ml2_type_gre tunnel_id_ranges $TENANT_TUNNEL_RANGES |
|
23 |
- elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
24 |
- iniset /$Q_PLUGIN_CONF_FILE ml2 tenant_network_types vlan |
|
25 |
- else |
|
26 |
- echo "WARNING - The ml2 plugin is using local tenant networks, with no connectivity between hosts." |
|
27 |
- fi |
|
28 |
- |
|
29 |
- # Override ``ML2_VLAN_RANGES`` and any needed agent configuration |
|
30 |
- # variables in ``localrc`` for more complex physical network |
|
31 |
- # configurations. |
|
32 |
- if [[ "$ML2_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
33 |
- ML2_VLAN_RANGES=$PHYSICAL_NETWORK |
|
34 |
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
35 |
- ML2_VLAN_RANGES=$ML2_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
36 |
- fi |
|
37 |
- fi |
|
38 |
- if [[ "$ML2_VLAN_RANGES" != "" ]]; then |
|
39 |
- iniset /$Q_PLUGIN_CONF_FILE ml2_type_vlan network_vlan_ranges $ML2_VLAN_RANGES |
|
40 |
- fi |
|
41 |
- |
|
42 |
- # REVISIT(rkukura): Setting firewall_driver here for |
|
43 |
- # quantum.agent.securitygroups_rpc.is_firewall_enabled() which is |
|
44 |
- # used in the server, in case no L2 agent is configured on the |
|
45 |
- # server's node. If an L2 agent is configured, this will get |
|
46 |
- # overridden with the correct driver. The ml2 plugin should |
|
47 |
- # instead use its own config variable to indicate whether security |
|
48 |
- # groups is enabled, and that will need to be set here instead. |
|
49 |
- if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
50 |
- iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver quantum.agent.not.a.real.FirewallDriver |
|
51 |
- else |
|
52 |
- iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver quantum.agent.firewall.NoopFirewallDriver |
|
53 |
- fi |
|
54 |
- |
|
55 |
-} |
|
56 |
- |
|
57 |
-function has_quantum_plugin_security_group() { |
|
58 |
- return 0 |
|
59 |
-} |
|
60 |
- |
|
61 |
-# Restore xtrace |
|
62 |
-$MY_XTRACE |
63 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,126 +0,0 @@ |
1 |
-# Quantum NEC OpenFlow plugin |
|
2 |
-# --------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-# Configuration parameters |
|
9 |
-OFC_HOST=${OFC_HOST:-127.0.0.1} |
|
10 |
-OFC_PORT=${OFC_PORT:-8888} |
|
11 |
- |
|
12 |
-OFC_API_HOST=${OFC_API_HOST:-$OFC_HOST} |
|
13 |
-OFC_API_PORT=${OFC_API_PORT:-$OFC_PORT} |
|
14 |
-OFC_OFP_HOST=${OFC_OFP_HOST:-$OFC_HOST} |
|
15 |
-OFC_OFP_PORT=${OFC_OFP_PORT:-6633} |
|
16 |
-OFC_DRIVER=${OFC_DRIVER:-trema} |
|
17 |
-OFC_RETRY_MAX=${OFC_RETRY_MAX:-0} |
|
18 |
-OFC_RETRY_INTERVAL=${OFC_RETRY_INTERVAL:-1} |
|
19 |
- |
|
20 |
-# Main logic |
|
21 |
-# --------------------------- |
|
22 |
- |
|
23 |
-source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
24 |
- |
|
25 |
-function quantum_plugin_create_nova_conf() { |
|
26 |
- _quantum_ovs_base_configure_nova_vif_driver |
|
27 |
-} |
|
28 |
- |
|
29 |
-function quantum_plugin_install_agent_packages() { |
|
30 |
- # SKIP_OVS_INSTALL is useful when we want to use Open vSwitch whose |
|
31 |
- # version is different from the version provided by the distribution. |
|
32 |
- if [[ "$SKIP_OVS_INSTALL" = "True" ]]; then |
|
33 |
- echo "You need to install Open vSwitch manually." |
|
34 |
- return |
|
35 |
- fi |
|
36 |
- _quantum_ovs_base_install_agent_packages |
|
37 |
-} |
|
38 |
- |
|
39 |
-function quantum_plugin_configure_common() { |
|
40 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/nec |
|
41 |
- Q_PLUGIN_CONF_FILENAME=nec.ini |
|
42 |
- Q_DB_NAME="quantum_nec" |
|
43 |
- Q_PLUGIN_CLASS="quantum.plugins.nec.nec_plugin.NECPluginV2" |
|
44 |
-} |
|
45 |
- |
|
46 |
-function quantum_plugin_configure_debug_command() { |
|
47 |
- _quantum_ovs_base_configure_debug_command |
|
48 |
-} |
|
49 |
- |
|
50 |
-function quantum_plugin_configure_dhcp_agent() { |
|
51 |
- : |
|
52 |
-} |
|
53 |
- |
|
54 |
-function quantum_plugin_configure_l3_agent() { |
|
55 |
- _quantum_ovs_base_configure_l3_agent |
|
56 |
-} |
|
57 |
- |
|
58 |
-function quantum_plugin_configure_plugin_agent() { |
|
59 |
- if [[ "$SKIP_OVS_BRIDGE_SETUP" = "True" ]]; then |
|
60 |
- return |
|
61 |
- fi |
|
62 |
- # Set up integration bridge |
|
63 |
- _quantum_ovs_base_setup_bridge $OVS_BRIDGE |
|
64 |
- sudo ovs-vsctl --no-wait set-controller $OVS_BRIDGE tcp:$OFC_OFP_HOST:$OFC_OFP_PORT |
|
65 |
- # Generate datapath ID from HOST_IP |
|
66 |
- local dpid=$(printf "0x%07d%03d%03d%03d\n" ${HOST_IP//./ }) |
|
67 |
- sudo ovs-vsctl --no-wait set Bridge $OVS_BRIDGE other-config:datapath-id=$dpid |
|
68 |
- sudo ovs-vsctl --no-wait set-fail-mode $OVS_BRIDGE secure |
|
69 |
- if [ -n "$OVS_INTERFACE" ]; then |
|
70 |
- sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $OVS_INTERFACE |
|
71 |
- fi |
|
72 |
- _quantum_setup_ovs_tunnels $OVS_BRIDGE |
|
73 |
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-nec-agent" |
|
74 |
- |
|
75 |
- _quantum_ovs_base_configure_firewall_driver |
|
76 |
-} |
|
77 |
- |
|
78 |
-function quantum_plugin_configure_service() { |
|
79 |
- iniset $QUANTUM_CONF DEFAULT api_extensions_path quantum/plugins/nec/extensions/ |
|
80 |
- iniset /$Q_PLUGIN_CONF_FILE ofc host $OFC_API_HOST |
|
81 |
- iniset /$Q_PLUGIN_CONF_FILE ofc port $OFC_API_PORT |
|
82 |
- iniset /$Q_PLUGIN_CONF_FILE ofc driver $OFC_DRIVER |
|
83 |
- iniset /$Q_PLUGIN_CONF_FILE ofc api_retry_max OFC_RETRY_MAX |
|
84 |
- iniset /$Q_PLUGIN_CONF_FILE ofc api_retry_interval OFC_RETRY_INTERVAL |
|
85 |
- |
|
86 |
- _quantum_ovs_base_configure_firewall_driver |
|
87 |
-} |
|
88 |
- |
|
89 |
-function quantum_plugin_setup_interface_driver() { |
|
90 |
- local conf_file=$1 |
|
91 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
92 |
- iniset $conf_file DEFAULT ovs_use_veth True |
|
93 |
-} |
|
94 |
- |
|
95 |
-# Utility functions |
|
96 |
-# --------------------------- |
|
97 |
- |
|
98 |
-# Setup OVS tunnel manually |
|
99 |
-function _quantum_setup_ovs_tunnels() { |
|
100 |
- local bridge=$1 |
|
101 |
- local id=0 |
|
102 |
- GRE_LOCAL_IP=${GRE_LOCAL_IP:-$HOST_IP} |
|
103 |
- if [ -n "$GRE_REMOTE_IPS" ]; then |
|
104 |
- for ip in ${GRE_REMOTE_IPS//:/ } |
|
105 |
- do |
|
106 |
- if [[ "$ip" == "$GRE_LOCAL_IP" ]]; then |
|
107 |
- continue |
|
108 |
- fi |
|
109 |
- sudo ovs-vsctl --no-wait add-port $bridge gre$id -- \ |
|
110 |
- set Interface gre$id type=gre options:remote_ip=$ip |
|
111 |
- id=`expr $id + 1` |
|
112 |
- done |
|
113 |
- fi |
|
114 |
-} |
|
115 |
- |
|
116 |
-function has_quantum_plugin_security_group() { |
|
117 |
- # 0 means True here |
|
118 |
- return 0 |
|
119 |
-} |
|
120 |
- |
|
121 |
-function quantum_plugin_check_adv_test_requirements() { |
|
122 |
- is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
123 |
-} |
|
124 |
- |
|
125 |
-# Restore xtrace |
|
126 |
-$MY_XTRACE |
127 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,138 +0,0 @@ |
1 |
-# Quantum Nicira NVP plugin |
|
2 |
-# --------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
9 |
- |
|
10 |
-function setup_integration_bridge() { |
|
11 |
- _quantum_ovs_base_setup_bridge $OVS_BRIDGE |
|
12 |
- # Set manager to NVP controller (1st of list) |
|
13 |
- if [[ "$NVP_CONTROLLERS" != "" ]]; then |
|
14 |
- # Get the first controller |
|
15 |
- controllers=(${NVP_CONTROLLERS//,/ }) |
|
16 |
- OVS_MGR_IP=${controllers[0]} |
|
17 |
- else |
|
18 |
- die $LINENO "Error - No controller specified. Unable to set a manager for OVS" |
|
19 |
- fi |
|
20 |
- sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP |
|
21 |
-} |
|
22 |
- |
|
23 |
-function is_quantum_ovs_base_plugin() { |
|
24 |
- # NVP uses OVS, but not the l3-agent |
|
25 |
- return 0 |
|
26 |
-} |
|
27 |
- |
|
28 |
-function quantum_plugin_create_nova_conf() { |
|
29 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"} |
|
30 |
- # if n-cpu is enabled, then setup integration bridge |
|
31 |
- if is_service_enabled n-cpu; then |
|
32 |
- setup_integration_bridge |
|
33 |
- fi |
|
34 |
-} |
|
35 |
- |
|
36 |
-function quantum_plugin_install_agent_packages() { |
|
37 |
- # Nicira Plugin does not run q-agt, but it currently needs dhcp and metadata agents |
|
38 |
- _quantum_ovs_base_install_agent_packages |
|
39 |
-} |
|
40 |
- |
|
41 |
-function quantum_plugin_configure_common() { |
|
42 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/nicira |
|
43 |
- Q_PLUGIN_CONF_FILENAME=nvp.ini |
|
44 |
- Q_DB_NAME="quantum_nvp" |
|
45 |
- Q_PLUGIN_CLASS="quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin.NvpPluginV2" |
|
46 |
-} |
|
47 |
- |
|
48 |
-function quantum_plugin_configure_debug_command() { |
|
49 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
|
50 |
-} |
|
51 |
- |
|
52 |
-function quantum_plugin_configure_dhcp_agent() { |
|
53 |
- setup_integration_bridge |
|
54 |
- iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True |
|
55 |
- iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True |
|
56 |
- iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True |
|
57 |
-} |
|
58 |
- |
|
59 |
-function quantum_plugin_configure_l3_agent() { |
|
60 |
- # Nicira plugin does not run L3 agent |
|
61 |
- die $LINENO "q-l3 should must not be executed with Nicira plugin!" |
|
62 |
-} |
|
63 |
- |
|
64 |
-function quantum_plugin_configure_plugin_agent() { |
|
65 |
- # Nicira plugin does not run L2 agent |
|
66 |
- die $LINENO "q-agt must not be executed with Nicira plugin!" |
|
67 |
-} |
|
68 |
- |
|
69 |
-function quantum_plugin_configure_service() { |
|
70 |
- if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then |
|
71 |
- iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS |
|
72 |
- fi |
|
73 |
- if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then |
|
74 |
- iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS |
|
75 |
- fi |
|
76 |
- if [[ "$FAILOVER_TIME" != "" ]]; then |
|
77 |
- iniset /$Q_PLUGIN_CONF_FILE nvp failover_time $FAILOVER_TIME |
|
78 |
- fi |
|
79 |
- if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then |
|
80 |
- iniset /$Q_PLUGIN_CONF_FILE nvp concurrent_connections $CONCURRENT_CONNECTIONS |
|
81 |
- fi |
|
82 |
- |
|
83 |
- if [[ "$DEFAULT_TZ_UUID" != "" ]]; then |
|
84 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_tz_uuid $DEFAULT_TZ_UUID |
|
85 |
- else |
|
86 |
- die $LINENO "The nicira plugin won't work without a default transport zone." |
|
87 |
- fi |
|
88 |
- if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then |
|
89 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID |
|
90 |
- Q_L3_ENABLED=True |
|
91 |
- Q_L3_ROUTER_PER_TENANT=True |
|
92 |
- iniset /$Q_PLUGIN_CONF_FILE nvp enable_metadata_access_network True |
|
93 |
- fi |
|
94 |
- if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then |
|
95 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID |
|
96 |
- fi |
|
97 |
- # NVP_CONTROLLERS must be a comma separated string |
|
98 |
- if [[ "$NVP_CONTROLLERS" != "" ]]; then |
|
99 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_controllers $NVP_CONTROLLERS |
|
100 |
- else |
|
101 |
- die $LINENO "The nicira plugin needs at least an NVP controller." |
|
102 |
- fi |
|
103 |
- if [[ "$NVP_USER" != "" ]]; then |
|
104 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_user $NVP_USER |
|
105 |
- fi |
|
106 |
- if [[ "$NVP_PASSWORD" != "" ]]; then |
|
107 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_password $NVP_PASSWORD |
|
108 |
- fi |
|
109 |
- if [[ "$NVP_REQ_TIMEOUT" != "" ]]; then |
|
110 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT req_timeout $NVP_REQ_TIMEOUT |
|
111 |
- fi |
|
112 |
- if [[ "$NVP_HTTP_TIMEOUT" != "" ]]; then |
|
113 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT http_timeout $NVP_HTTP_TIMEOUT |
|
114 |
- fi |
|
115 |
- if [[ "$NVP_RETRIES" != "" ]]; then |
|
116 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT retries $NVP_RETRIES |
|
117 |
- fi |
|
118 |
- if [[ "$NVP_REDIRECTS" != "" ]]; then |
|
119 |
- iniset /$Q_PLUGIN_CONF_FILE DEFAULT redirects $NVP_REDIRECTS |
|
120 |
- fi |
|
121 |
-} |
|
122 |
- |
|
123 |
-function quantum_plugin_setup_interface_driver() { |
|
124 |
- local conf_file=$1 |
|
125 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
126 |
-} |
|
127 |
- |
|
128 |
-function has_quantum_plugin_security_group() { |
|
129 |
- # 0 means True here |
|
130 |
- return 0 |
|
131 |
-} |
|
132 |
- |
|
133 |
-function quantum_plugin_check_adv_test_requirements() { |
|
134 |
- is_service_enabled q-dhcp && return 0 |
|
135 |
-} |
|
136 |
- |
|
137 |
-# Restore xtrace |
|
138 |
-$MY_XTRACE |
139 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,60 +0,0 @@ |
1 |
-# Quantum Open vSwitch plugin |
|
2 |
-# --------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-source $TOP_DIR/lib/quantum_plugins/openvswitch_agent |
|
9 |
- |
|
10 |
-function quantum_plugin_configure_common() { |
|
11 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/openvswitch |
|
12 |
- Q_PLUGIN_CONF_FILENAME=ovs_quantum_plugin.ini |
|
13 |
- Q_DB_NAME="ovs_quantum" |
|
14 |
- Q_PLUGIN_CLASS="quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2" |
|
15 |
-} |
|
16 |
- |
|
17 |
-function quantum_plugin_configure_service() { |
|
18 |
- if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then |
|
19 |
- iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type gre |
|
20 |
- iniset /$Q_PLUGIN_CONF_FILE ovs tunnel_id_ranges $TENANT_TUNNEL_RANGES |
|
21 |
- elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then |
|
22 |
- iniset /$Q_PLUGIN_CONF_FILE ovs tenant_network_type vlan |
|
23 |
- else |
|
24 |
- echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts." |
|
25 |
- fi |
|
26 |
- |
|
27 |
- # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` |
|
28 |
- # for more complex physical network configurations. |
|
29 |
- if [[ "$OVS_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then |
|
30 |
- OVS_VLAN_RANGES=$PHYSICAL_NETWORK |
|
31 |
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then |
|
32 |
- OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE |
|
33 |
- fi |
|
34 |
- fi |
|
35 |
- if [[ "$OVS_VLAN_RANGES" != "" ]]; then |
|
36 |
- iniset /$Q_PLUGIN_CONF_FILE ovs network_vlan_ranges $OVS_VLAN_RANGES |
|
37 |
- fi |
|
38 |
- |
|
39 |
- # Enable tunnel networks if selected |
|
40 |
- if [[ $OVS_ENABLE_TUNNELING = "True" ]]; then |
|
41 |
- iniset /$Q_PLUGIN_CONF_FILE ovs enable_tunneling True |
|
42 |
- fi |
|
43 |
- |
|
44 |
- _quantum_ovs_base_configure_firewall_driver |
|
45 |
- |
|
46 |
- # Define extra "OVS" configuration options when q-svc is configured by defining |
|
47 |
- # the array ``Q_SRV_EXTRA_OPTS``. |
|
48 |
- # For Example: ``Q_SRV_EXTRA_OPTS=(foo=true bar=2)`` |
|
49 |
- for I in "${Q_SRV_EXTRA_OPTS[@]}"; do |
|
50 |
- # Replace the first '=' with ' ' for iniset syntax |
|
51 |
- iniset /$Q_PLUGIN_CONF_FILE ovs ${I/=/ } |
|
52 |
- done |
|
53 |
-} |
|
54 |
- |
|
55 |
-function has_quantum_plugin_security_group() { |
|
56 |
- return 0 |
|
57 |
-} |
|
58 |
- |
|
59 |
-# Restore xtrace |
|
60 |
-$MY_XTRACE |
61 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,131 +0,0 @@ |
1 |
-# Quantum Open vSwitch L2 agent |
|
2 |
-# ----------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-PLUGIN_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
9 |
- |
|
10 |
-function quantum_plugin_create_nova_conf() { |
|
11 |
- _quantum_ovs_base_configure_nova_vif_driver |
|
12 |
- if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
13 |
- iniset $NOVA_CONF DEFAULT xenapi_vif_driver nova.virt.xenapi.vif.XenAPIOpenVswitchDriver |
|
14 |
- iniset $NOVA_CONF DEFAULT xenapi_ovs_integration_bridge $XEN_INTEGRATION_BRIDGE |
|
15 |
- # Disable nova's firewall so that it does not conflict with quantum |
|
16 |
- iniset $NOVA_CONF DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver |
|
17 |
- fi |
|
18 |
-} |
|
19 |
- |
|
20 |
-function quantum_plugin_install_agent_packages() { |
|
21 |
- _quantum_ovs_base_install_agent_packages |
|
22 |
-} |
|
23 |
- |
|
24 |
-function quantum_plugin_configure_debug_command() { |
|
25 |
- _quantum_ovs_base_configure_debug_command |
|
26 |
-} |
|
27 |
- |
|
28 |
-function quantum_plugin_configure_dhcp_agent() { |
|
29 |
- iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager quantum.agent.dhcp_agent.DhcpAgentWithStateReport |
|
30 |
-} |
|
31 |
- |
|
32 |
-function quantum_plugin_configure_l3_agent() { |
|
33 |
- _quantum_ovs_base_configure_l3_agent |
|
34 |
- iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager quantum.agent.l3_agent.L3NATAgentWithStateReport |
|
35 |
-} |
|
36 |
- |
|
37 |
-function quantum_plugin_configure_plugin_agent() { |
|
38 |
- # Setup integration bridge |
|
39 |
- _quantum_ovs_base_setup_bridge $OVS_BRIDGE |
|
40 |
- _quantum_ovs_base_configure_firewall_driver |
|
41 |
- |
|
42 |
- # Setup agent for tunneling |
|
43 |
- if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then |
|
44 |
- # Verify tunnels are supported |
|
45 |
- # REVISIT - also check kernel module support for GRE and patch ports |
|
46 |
- OVS_VERSION=`ovs-vsctl --version | head -n 1 | grep -E -o "[0-9]+\.[0-9]+"` |
|
47 |
- if [ `vercmp_numbers "$OVS_VERSION" "1.4"` -lt "0" ] && ! is_service_enabled q-svc ; then |
|
48 |
- die $LINENO "You are running OVS version $OVS_VERSION. OVS 1.4+ is required for tunneling between multiple hosts." |
|
49 |
- fi |
|
50 |
- iniset /$Q_PLUGIN_CONF_FILE ovs enable_tunneling True |
|
51 |
- iniset /$Q_PLUGIN_CONF_FILE ovs local_ip $HOST_IP |
|
52 |
- fi |
|
53 |
- |
|
54 |
- # Setup physical network bridge mappings. Override |
|
55 |
- # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more |
|
56 |
- # complex physical network configurations. |
|
57 |
- if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then |
|
58 |
- OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE |
|
59 |
- |
|
60 |
- # Configure bridge manually with physical interface as port for multi-node |
|
61 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE |
|
62 |
- fi |
|
63 |
- if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then |
|
64 |
- iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings $OVS_BRIDGE_MAPPINGS |
|
65 |
- fi |
|
66 |
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-openvswitch-agent" |
|
67 |
- |
|
68 |
- if [ "$VIRT_DRIVER" = 'xenserver' ]; then |
|
69 |
- # Make a copy of our config for domU |
|
70 |
- sudo cp /$Q_PLUGIN_CONF_FILE "/$Q_PLUGIN_CONF_FILE.domu" |
|
71 |
- |
|
72 |
- # Deal with Dom0's L2 Agent: |
|
73 |
- Q_RR_DOM0_COMMAND="$QUANTUM_DIR/bin/quantum-rootwrap-xen-dom0 $Q_RR_CONF_FILE" |
|
74 |
- |
|
75 |
- # For now, duplicate the xen configuration already found in nova.conf |
|
76 |
- iniset $Q_RR_CONF_FILE xenapi xenapi_connection_url "$XENAPI_CONNECTION_URL" |
|
77 |
- iniset $Q_RR_CONF_FILE xenapi xenapi_connection_username "$XENAPI_USER" |
|
78 |
- iniset $Q_RR_CONF_FILE xenapi xenapi_connection_password "$XENAPI_PASSWORD" |
|
79 |
- |
|
80 |
- # Under XS/XCP, the ovs agent needs to target the dom0 |
|
81 |
- # integration bridge. This is enabled by using a root wrapper |
|
82 |
- # that executes commands on dom0 via a XenAPI plugin. |
|
83 |
- iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_DOM0_COMMAND" |
|
84 |
- |
|
85 |
- # Set "physical" mapping |
|
86 |
- iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings "physnet1:$FLAT_NETWORK_BRIDGE" |
|
87 |
- |
|
88 |
- # XEN_INTEGRATION_BRIDGE is the integration bridge in dom0 |
|
89 |
- iniset /$Q_PLUGIN_CONF_FILE ovs integration_bridge $XEN_INTEGRATION_BRIDGE |
|
90 |
- |
|
91 |
- # Set up domU's L2 agent: |
|
92 |
- |
|
93 |
- # Create a bridge "br-$GUEST_INTERFACE_DEFAULT" |
|
94 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br "br-$GUEST_INTERFACE_DEFAULT" |
|
95 |
- # Add $GUEST_INTERFACE_DEFAULT to that bridge |
|
96 |
- sudo ovs-vsctl add-port "br-$GUEST_INTERFACE_DEFAULT" $GUEST_INTERFACE_DEFAULT |
|
97 |
- |
|
98 |
- # Set bridge mappings to "physnet1:br-$GUEST_INTERFACE_DEFAULT" |
|
99 |
- iniset "/$Q_PLUGIN_CONF_FILE.domU" ovs bridge_mappings "physnet1:br-$GUEST_INTERFACE_DEFAULT" |
|
100 |
- # Set integration bridge to domU's |
|
101 |
- iniset "/$Q_PLUGIN_CONF_FILE.domU" ovs integration_bridge $OVS_BRIDGE |
|
102 |
- # Set root wrap |
|
103 |
- iniset "/$Q_PLUGIN_CONF_FILE.domU" agent root_helper "$Q_RR_COMMAND" |
|
104 |
- fi |
|
105 |
- # Define extra "AGENT" configuration options when q-agt is configured by defining |
|
106 |
- # defining the array ``Q_AGENT_EXTRA_AGENT_OPTS``. |
|
107 |
- # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)`` |
|
108 |
- for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do |
|
109 |
- # Replace the first '=' with ' ' for iniset syntax |
|
110 |
- iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ } |
|
111 |
- done |
|
112 |
- # Define extra "OVS" configuration options when q-agt is configured by defining |
|
113 |
- # defining the array ``Q_AGENT_EXTRA_SRV_OPTS``. |
|
114 |
- # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)`` |
|
115 |
- for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do |
|
116 |
- # Replace the first '=' with ' ' for iniset syntax |
|
117 |
- iniset /$Q_PLUGIN_CONF_FILE ovs ${I/=/ } |
|
118 |
- done |
|
119 |
-} |
|
120 |
- |
|
121 |
-function quantum_plugin_setup_interface_driver() { |
|
122 |
- local conf_file=$1 |
|
123 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
124 |
-} |
|
125 |
- |
|
126 |
-function quantum_plugin_check_adv_test_requirements() { |
|
127 |
- is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
128 |
-} |
|
129 |
- |
|
130 |
-# Restore xtrace |
|
131 |
-$PLUGIN_XTRACE |
132 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,85 +0,0 @@ |
1 |
-# common functions for ovs based plugin |
|
2 |
-# ------------------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-OVS_BRIDGE=${OVS_BRIDGE:-br-int} |
|
9 |
-PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex} |
|
10 |
- |
|
11 |
-function is_quantum_ovs_base_plugin() { |
|
12 |
- # Yes, we use OVS. |
|
13 |
- return 0 |
|
14 |
-} |
|
15 |
- |
|
16 |
-function _quantum_ovs_base_setup_bridge() { |
|
17 |
- local bridge=$1 |
|
18 |
- quantum-ovs-cleanup |
|
19 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge |
|
20 |
- sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge |
|
21 |
-} |
|
22 |
- |
|
23 |
-function quantum_ovs_base_cleanup() { |
|
24 |
- # remove all OVS ports that look like Quantum created ports |
|
25 |
- for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do |
|
26 |
- sudo ovs-vsctl del-port ${port} |
|
27 |
- done |
|
28 |
- |
|
29 |
- # remove all OVS bridges created by Quantum |
|
30 |
- for bridge in $(sudo ovs-vsctl list-br | grep -o -e ${OVS_BRIDGE} -e ${PUBLIC_BRIDGE}); do |
|
31 |
- sudo ovs-vsctl del-br ${bridge} |
|
32 |
- done |
|
33 |
-} |
|
34 |
- |
|
35 |
-function _quantum_ovs_base_install_agent_packages() { |
|
36 |
- local kernel_version |
|
37 |
- # Install deps |
|
38 |
- # FIXME add to ``files/apts/quantum``, but don't install if not needed! |
|
39 |
- if is_ubuntu; then |
|
40 |
- kernel_version=`cat /proc/version | cut -d " " -f3` |
|
41 |
- install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
|
42 |
- elif is_fedora; then |
|
43 |
- install_package openvswitch |
|
44 |
- # Ensure that the service is started |
|
45 |
- restart_service openvswitch |
|
46 |
- elif is_suse; then |
|
47 |
- ### FIXME: Find out if package can be pushed to Factory |
|
48 |
- echo "OpenVSwitch packages can be installed from Cloud:OpenStack:Master in OBS" |
|
49 |
- restart_service openvswitch |
|
50 |
- fi |
|
51 |
-} |
|
52 |
- |
|
53 |
-function _quantum_ovs_base_configure_debug_command() { |
|
54 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
55 |
-} |
|
56 |
- |
|
57 |
-function _quantum_ovs_base_configure_firewall_driver() { |
|
58 |
- if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
59 |
- iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver |
|
60 |
- else |
|
61 |
- iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver quantum.agent.firewall.NoopFirewallDriver |
|
62 |
- fi |
|
63 |
-} |
|
64 |
- |
|
65 |
-function _quantum_ovs_base_configure_l3_agent() { |
|
66 |
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE |
|
67 |
- |
|
68 |
- quantum-ovs-cleanup |
|
69 |
- sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
|
70 |
- # ensure no IP is configured on the public bridge |
|
71 |
- sudo ip addr flush dev $PUBLIC_BRIDGE |
|
72 |
-} |
|
73 |
- |
|
74 |
-function _quantum_ovs_base_configure_nova_vif_driver() { |
|
75 |
- # The hybrid VIF driver needs to be specified when Quantum Security Group |
|
76 |
- # is enabled (until vif_security attributes are supported in VIF extension) |
|
77 |
- if [[ "$Q_USE_SECGROUP" == "True" ]]; then |
|
78 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"} |
|
79 |
- else |
|
80 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
81 |
- fi |
|
82 |
-} |
|
83 |
- |
|
84 |
-# Restore xtrace |
|
85 |
-$MY_XTRACE |
86 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,42 +0,0 @@ |
1 |
-# PLUMgrid Quantum Plugin |
|
2 |
-# Edgar Magana emagana@plumgrid.com |
|
3 |
-# ------------------------------------ |
|
4 |
- |
|
5 |
-# Save trace settings |
|
6 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
7 |
-set +o xtrace |
|
8 |
- |
|
9 |
-#source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
10 |
- |
|
11 |
-function quantum_plugin_create_nova_conf() { |
|
12 |
- |
|
13 |
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtGenericVIFDriver"} |
|
14 |
-} |
|
15 |
- |
|
16 |
-function quantum_plugin_setup_interface_driver() { |
|
17 |
- : |
|
18 |
-} |
|
19 |
- |
|
20 |
-function quantum_plugin_configure_common() { |
|
21 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/plumgrid |
|
22 |
- Q_PLUGIN_CONF_FILENAME=plumgrid.ini |
|
23 |
- Q_DB_NAME="plumgrid_quantum" |
|
24 |
- Q_PLUGIN_CLASS="quantum.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.QuantumPluginPLUMgridV2" |
|
25 |
-} |
|
26 |
- |
|
27 |
-function quantum_plugin_configure_service() { |
|
28 |
- PLUMGRID_NOS_IP=${PLUMGRID_NOS_IP:-localhost} |
|
29 |
- PLUMGRID_NOS_PORT=${PLUMGRID_NOS_PORT:-7766} |
|
30 |
- iniset /$Q_PLUGIN_CONF_FILE plumgridnos nos_server $PLUMGRID_NOS_IP |
|
31 |
- iniset /$Q_PLUGIN_CONF_FILE plumgridnos nos_server_port $PLUMGRID_NOS_PORT |
|
32 |
-} |
|
33 |
- |
|
34 |
-function quantum_plugin_configure_debug_command() { |
|
35 |
- : |
|
36 |
-} |
|
37 |
- |
|
38 |
-function quantum_plugin_check_adv_test_requirements() { |
|
39 |
- is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
40 |
-} |
|
41 |
-# Restore xtrace |
|
42 |
-$MY_XTRACE |
43 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,80 +0,0 @@ |
1 |
-# Quantum Ryu plugin |
|
2 |
-# ------------------ |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-source $TOP_DIR/lib/quantum_plugins/ovs_base |
|
9 |
-source $TOP_DIR/lib/quantum_thirdparty/ryu # for configuration value |
|
10 |
- |
|
11 |
-function quantum_plugin_create_nova_conf() { |
|
12 |
- _quantum_ovs_base_configure_nova_vif_driver |
|
13 |
- iniset $NOVA_CONF DEFAULT libvirt_ovs_integration_bridge "$OVS_BRIDGE" |
|
14 |
-} |
|
15 |
- |
|
16 |
-function quantum_plugin_install_agent_packages() { |
|
17 |
- _quantum_ovs_base_install_agent_packages |
|
18 |
- |
|
19 |
- # quantum_ryu_agent requires ryu module |
|
20 |
- install_package $(get_packages "ryu") |
|
21 |
- install_ryu |
|
22 |
- configure_ryu |
|
23 |
-} |
|
24 |
- |
|
25 |
-function quantum_plugin_configure_common() { |
|
26 |
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ryu |
|
27 |
- Q_PLUGIN_CONF_FILENAME=ryu.ini |
|
28 |
- Q_DB_NAME="ovs_quantum" |
|
29 |
- Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2" |
|
30 |
-} |
|
31 |
- |
|
32 |
-function quantum_plugin_configure_debug_command() { |
|
33 |
- _quantum_ovs_base_configure_debug_command |
|
34 |
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
35 |
-} |
|
36 |
- |
|
37 |
-function quantum_plugin_configure_dhcp_agent() { |
|
38 |
- iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
39 |
-} |
|
40 |
- |
|
41 |
-function quantum_plugin_configure_l3_agent() { |
|
42 |
- iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT |
|
43 |
- _quantum_ovs_base_configure_l3_agent |
|
44 |
-} |
|
45 |
- |
|
46 |
-function quantum_plugin_configure_plugin_agent() { |
|
47 |
- # Set up integration bridge |
|
48 |
- _quantum_ovs_base_setup_bridge $OVS_BRIDGE |
|
49 |
- if [ -n "$RYU_INTERNAL_INTERFACE" ]; then |
|
50 |
- sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE |
|
51 |
- fi |
|
52 |
- iniset /$Q_PLUGIN_CONF_FILE ovs integration_bridge $OVS_BRIDGE |
|
53 |
- AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/ryu/agent/ryu_quantum_agent.py" |
|
54 |
- |
|
55 |
- _quantum_ovs_base_configure_firewall_driver |
|
56 |
-} |
|
57 |
- |
|
58 |
-function quantum_plugin_configure_service() { |
|
59 |
- iniset /$Q_PLUGIN_CONF_FILE ovs openflow_rest_api $RYU_API_HOST:$RYU_API_PORT |
|
60 |
- |
|
61 |
- _quantum_ovs_base_configure_firewall_driver |
|
62 |
-} |
|
63 |
- |
|
64 |
-function quantum_plugin_setup_interface_driver() { |
|
65 |
- local conf_file=$1 |
|
66 |
- iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver |
|
67 |
- iniset $conf_file DEFAULT ovs_use_veth True |
|
68 |
-} |
|
69 |
- |
|
70 |
-function has_quantum_plugin_security_group() { |
|
71 |
- # 0 means True here |
|
72 |
- return 0 |
|
73 |
-} |
|
74 |
- |
|
75 |
-function quantum_plugin_check_adv_test_requirements() { |
|
76 |
- is_service_enabled q-agt && is_service_enabled q-dhcp && return 0 |
|
77 |
-} |
|
78 |
- |
|
79 |
-# Restore xtrace |
|
80 |
-$MY_XTRACE |
81 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,50 +0,0 @@ |
1 |
-# Quantum loadbalancer plugin |
|
2 |
-# --------------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
- |
|
9 |
-AGENT_LBAAS_BINARY="$QUANTUM_DIR/bin/quantum-lbaas-agent" |
|
10 |
-LBAAS_PLUGIN=quantum.services.loadbalancer.plugin.LoadBalancerPlugin |
|
11 |
- |
|
12 |
-function quantum_agent_lbaas_install_agent_packages() { |
|
13 |
- if is_ubuntu || is_fedora; then |
|
14 |
- install_package haproxy |
|
15 |
- elif is_suse; then |
|
16 |
- ### FIXME: Find out if package can be pushed to Factory |
|
17 |
- echo "HAProxy packages can be installed from server:http project in OBS" |
|
18 |
- fi |
|
19 |
-} |
|
20 |
- |
|
21 |
-function quantum_agent_lbaas_configure_common() { |
|
22 |
- if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then |
|
23 |
- Q_SERVICE_PLUGIN_CLASSES=$LBAAS_PLUGIN |
|
24 |
- else |
|
25 |
- Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$LBAAS_PLUGIN" |
|
26 |
- fi |
|
27 |
-} |
|
28 |
- |
|
29 |
-function quantum_agent_lbaas_configure_agent() { |
|
30 |
- LBAAS_AGENT_CONF_PATH=/etc/quantum/services/loadbalancer/haproxy |
|
31 |
- mkdir -p $LBAAS_AGENT_CONF_PATH |
|
32 |
- |
|
33 |
- LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini" |
|
34 |
- |
|
35 |
- cp $QUANTUM_DIR/etc/lbaas_agent.ini $LBAAS_AGENT_CONF_FILENAME |
|
36 |
- |
|
37 |
- iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT use_namespaces $Q_USE_NAMESPACE |
|
38 |
- # ovs_use_veth needs to be set before the plugin configuration |
|
39 |
- # occurs to allow plugins to override the setting. |
|
40 |
- iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH |
|
41 |
- |
|
42 |
- quantum_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME |
|
43 |
- |
|
44 |
- if is_fedora; then |
|
45 |
- iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody" |
|
46 |
- fi |
|
47 |
-} |
|
48 |
- |
|
49 |
-# Restore xtrace |
|
50 |
-$MY_XTRACE |
51 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,36 +0,0 @@ |
1 |
-Quantum third party specific files |
|
2 |
-================================== |
|
3 |
-Some Quantum plugins require third party programs to function. |
|
4 |
-The files under the directory, ``lib/quantum_thirdparty/``, will be used |
|
5 |
-when their service are enabled. |
|
6 |
-Third party program specific configuration variables should be in this file. |
|
7 |
- |
|
8 |
-* filename: ``<third_party>`` |
|
9 |
- * The corresponding file name should be same to service name, ``<third_party>``. |
|
10 |
- |
|
11 |
-functions |
|
12 |
-``lib/quantum`` calls the following functions when the ``<third_party>`` is enabled |
|
13 |
- |
|
14 |
-functions to be implemented |
|
15 |
-* ``configure_<third_party>``: |
|
16 |
- set config files, create data dirs, etc |
|
17 |
- e.g. |
|
18 |
- sudo python setup.py deploy |
|
19 |
- iniset $XXXX_CONF... |
|
20 |
- |
|
21 |
-* ``init_<third_party>``: |
|
22 |
- initialize databases, etc |
|
23 |
- |
|
24 |
-* ``install_<third_party>``: |
|
25 |
- collect source and prepare |
|
26 |
- e.g. |
|
27 |
- git clone xxx |
|
28 |
- |
|
29 |
-* ``start_<third_party>``: |
|
30 |
- start running processes, including screen |
|
31 |
- e.g. |
|
32 |
- screen_it XXXX "cd $XXXXY_DIR && $XXXX_DIR/bin/XXXX-bin" |
|
33 |
- |
|
34 |
-* ``stop_<third_party>``: |
|
35 |
- stop running processes (non-screen) |
36 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,49 +0,0 @@ |
1 |
-# Big Switch/FloodLight OpenFlow Controller |
|
2 |
-# ------------------------------------------ |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
-BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80} |
|
9 |
-BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633} |
|
10 |
- |
|
11 |
-function configure_bigswitch_floodlight() { |
|
12 |
- : |
|
13 |
-} |
|
14 |
- |
|
15 |
-function init_bigswitch_floodlight() { |
|
16 |
- install_quantum_agent_packages |
|
17 |
- |
|
18 |
- echo -n "Installing OVS managed by the openflow controllers:" |
|
19 |
- echo ${BS_FL_CONTROLLERS_PORT} |
|
20 |
- |
|
21 |
- # Create local OVS bridge and configure it |
|
22 |
- sudo ovs-vsctl --no-wait -- --if-exists del-br ${OVS_BRIDGE} |
|
23 |
- sudo ovs-vsctl --no-wait add-br ${OVS_BRIDGE} |
|
24 |
- sudo ovs-vsctl --no-wait br-set-external-id ${OVS_BRIDGE} bridge-id ${OVS_BRIDGE} |
|
25 |
- |
|
26 |
- ctrls= |
|
27 |
- for ctrl in `echo ${BS_FL_CONTROLLERS_PORT} | tr ',' ' '` |
|
28 |
- do |
|
29 |
- ctrl=${ctrl%:*} |
|
30 |
- ctrls="${ctrls} tcp:${ctrl}:${BS_FL_OF_PORT}" |
|
31 |
- done |
|
32 |
- echo "Adding Network conttrollers: " ${ctrls} |
|
33 |
- sudo ovs-vsctl --no-wait set-controller ${OVS_BRIDGE} ${ctrls} |
|
34 |
-} |
|
35 |
- |
|
36 |
-function install_bigswitch_floodlight() { |
|
37 |
- : |
|
38 |
-} |
|
39 |
- |
|
40 |
-function start_bigswitch_floodlight() { |
|
41 |
- : |
|
42 |
-} |
|
43 |
- |
|
44 |
-function stop_bigswitch_floodlight() { |
|
45 |
- : |
|
46 |
-} |
|
47 |
- |
|
48 |
-# Restore xtrace |
|
49 |
-$MY_XTRACE |
50 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,52 +0,0 @@ |
1 |
-# Nicira NVP |
|
2 |
-# ---------- |
|
3 |
- |
|
4 |
-# This third-party addition can be used to configure connectivity between a DevStack instance |
|
5 |
-# and an NVP Gateway in dev/test environments. In order to use this correctly, the following |
|
6 |
-# env variables need to be set (e.g. in your localrc file): |
|
7 |
-# |
|
8 |
-# * enable_service nicira --> to execute this third-party addition |
|
9 |
-# * PUBLIC_BRIDGE --> bridge used for external connectivity, typically br-ex |
|
10 |
-# * NVP_GATEWAY_NETWORK_INTERFACE --> interface used to communicate with the NVP Gateway |
|
11 |
-# * NVP_GATEWAY_NETWORK_CIDR --> CIDR to configure br-ex, e.g. 172.24.4.211/24 |
|
12 |
- |
|
13 |
-# Save trace setting |
|
14 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
15 |
-set +o xtrace |
|
16 |
- |
|
17 |
-# This is the interface that connects the Devstack instance |
|
18 |
-# to an network that allows it to talk to the gateway for |
|
19 |
-# testing purposes |
|
20 |
-NVP_GATEWAY_NETWORK_INTERFACE=${NVP_GATEWAY_NETWORK_INTERFACE:-eth2} |
|
21 |
- |
|
22 |
-function configure_nicira() { |
|
23 |
- : |
|
24 |
-} |
|
25 |
- |
|
26 |
-function init_nicira() { |
|
27 |
- die_if_not_set $LINENO NVP_GATEWAY_NETWORK_CIDR "Please, specify CIDR for the gateway network interface." |
|
28 |
- # Make sure the interface is up, but not configured |
|
29 |
- sudo ifconfig $NVP_GATEWAY_NETWORK_INTERFACE up |
|
30 |
- sudo ip addr flush $NVP_GATEWAY_NETWORK_INTERFACE |
|
31 |
- # Use the PUBLIC Bridge to route traffic to the NVP gateway |
|
32 |
- # NOTE(armando-migliaccio): if running in a nested environment this will work |
|
33 |
- # only with mac learning enabled, portsecurity and security profiles disabled |
|
34 |
- sudo ovs-vsctl -- --may-exist add-port $PUBLIC_BRIDGE $NVP_GATEWAY_NETWORK_INTERFACE |
|
35 |
- nvp_gw_net_if_mac=$(ip link show $NVP_GATEWAY_NETWORK_INTERFACE | awk '/ether/ {print $2}') |
|
36 |
- sudo ifconfig $PUBLIC_BRIDGE $NVP_GATEWAY_NETWORK_CIDR hw ether $nvp_gw_net_if_mac |
|
37 |
-} |
|
38 |
- |
|
39 |
-function install_nicira() { |
|
40 |
- : |
|
41 |
-} |
|
42 |
- |
|
43 |
-function start_nicira() { |
|
44 |
- : |
|
45 |
-} |
|
46 |
- |
|
47 |
-function stop_nicira() { |
|
48 |
- : |
|
49 |
-} |
|
50 |
- |
|
51 |
-# Restore xtrace |
|
52 |
-$MY_XTRACE |
53 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,79 +0,0 @@ |
1 |
-# Ryu OpenFlow Controller |
|
2 |
-# ----------------------- |
|
3 |
- |
|
4 |
-# Save trace setting |
|
5 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
6 |
-set +o xtrace |
|
7 |
- |
|
8 |
- |
|
9 |
-RYU_DIR=$DEST/ryu |
|
10 |
-# Ryu API Host |
|
11 |
-RYU_API_HOST=${RYU_API_HOST:-127.0.0.1} |
|
12 |
-# Ryu API Port |
|
13 |
-RYU_API_PORT=${RYU_API_PORT:-8080} |
|
14 |
-# Ryu OFP Host |
|
15 |
-RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1} |
|
16 |
-# Ryu OFP Port |
|
17 |
-RYU_OFP_PORT=${RYU_OFP_PORT:-6633} |
|
18 |
-# Ryu Applications |
|
19 |
-RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest} |
|
20 |
- |
|
21 |
-# configure_ryu can be called multiple times as quantum_pluing/ryu may call |
|
22 |
-# this function for quantum-ryu-agent |
|
23 |
-_RYU_CONFIGURED=${_RYU_CONFIGURED:-False} |
|
24 |
-function configure_ryu() { |
|
25 |
- if [[ "$_RYU_CONFIGURED" == "False" ]]; then |
|
26 |
- setup_develop $RYU_DIR |
|
27 |
- _RYU_CONFIGURED=True |
|
28 |
- fi |
|
29 |
-} |
|
30 |
- |
|
31 |
-function init_ryu() { |
|
32 |
- RYU_CONF_DIR=/etc/ryu |
|
33 |
- if [[ ! -d $RYU_CONF_DIR ]]; then |
|
34 |
- sudo mkdir -p $RYU_CONF_DIR |
|
35 |
- fi |
|
36 |
- sudo chown $STACK_USER $RYU_CONF_DIR |
|
37 |
- RYU_CONF=$RYU_CONF_DIR/ryu.conf |
|
38 |
- sudo rm -rf $RYU_CONF |
|
39 |
- |
|
40 |
- # Ryu configuration |
|
41 |
- RYU_CONF_CONTENTS=${RYU_CONF_CONTENTS:-"[DEFAULT] |
|
42 |
-app_lists=$RYU_APPS |
|
43 |
-wsapi_host=$RYU_API_HOST |
|
44 |
-wsapi_port=$RYU_API_PORT |
|
45 |
-ofp_listen_host=$RYU_OFP_HOST |
|
46 |
-ofp_tcp_listen_port=$RYU_OFP_PORT |
|
47 |
-quantum_url=http://$Q_HOST:$Q_PORT |
|
48 |
-quantum_admin_username=$Q_ADMIN_USERNAME |
|
49 |
-quantum_admin_password=$SERVICE_PASSWORD |
|
50 |
-quantum_admin_tenant_name=$SERVICE_TENANT_NAME |
|
51 |
-quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0 |
|
52 |
-quantum_auth_strategy=$Q_AUTH_STRATEGY |
|
53 |
-quantum_controller_addr=tcp:$RYU_OFP_HOST:$RYU_OFP_PORT |
|
54 |
-"} |
|
55 |
- echo "${RYU_CONF_CONTENTS}" > $RYU_CONF |
|
56 |
-} |
|
57 |
- |
|
58 |
-# install_ryu can be called multiple times as quantum_pluing/ryu may call |
|
59 |
-# this function for quantum-ryu-agent |
|
60 |
-# Make this function idempotent and avoid cloning same repo many times |
|
61 |
-# with RECLONE=yes |
|
62 |
-_RYU_INSTALLED=${_RYU_INSTALLED:-False} |
|
63 |
-function install_ryu() { |
|
64 |
- if [[ "$_RYU_INSTALLED" == "False" ]]; then |
|
65 |
- git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH |
|
66 |
- _RYU_INSTALLED=True |
|
67 |
- fi |
|
68 |
-} |
|
69 |
- |
|
70 |
-function start_ryu() { |
|
71 |
- screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --config-file $RYU_CONF" |
|
72 |
-} |
|
73 |
- |
|
74 |
-function stop_ryu() { |
|
75 |
- : |
|
76 |
-} |
|
77 |
- |
|
78 |
-# Restore xtrace |
|
79 |
-$MY_XTRACE |
80 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,113 +0,0 @@ |
1 |
-# Trema Sliceable Switch |
|
2 |
-# ---------------------- |
|
3 |
- |
|
4 |
-# Trema is a Full-Stack OpenFlow Framework in Ruby and C |
|
5 |
-# https://github.com/trema/trema |
|
6 |
-# |
|
7 |
-# Trema Sliceable Switch is an OpenFlow controller which provides |
|
8 |
-# virtual layer-2 network slices. |
|
9 |
-# https://github.com/trema/apps/wiki |
|
10 |
- |
|
11 |
-# Trema Sliceable Switch (OpenFlow Controller) |
|
12 |
-TREMA_APPS_REPO=${TREMA_APPS_REPO:-https://github.com/trema/apps.git} |
|
13 |
-TREMA_APPS_BRANCH=${TREMA_APPS_BRANCH:-master} |
|
14 |
- |
|
15 |
-# Save trace setting |
|
16 |
-MY_XTRACE=$(set +o | grep xtrace) |
|
17 |
-set +o xtrace |
|
18 |
- |
|
19 |
-TREMA_DIR=${TREMA_DIR:-$DEST/trema} |
|
20 |
-TREMA_SS_DIR="$TREMA_DIR/apps/sliceable_switch" |
|
21 |
- |
|
22 |
-TREMA_DATA_DIR=${TREMA_DATA_DIR:-$DATA_DIR/trema} |
|
23 |
-TREMA_SS_ETC_DIR=$TREMA_DATA_DIR/sliceable_switch/etc |
|
24 |
-TREMA_SS_DB_DIR=$TREMA_DATA_DIR/sliceable_switch/db |
|
25 |
-TREMA_SS_SCRIPT_DIR=$TREMA_DATA_DIR/sliceable_switch/script |
|
26 |
-TREMA_TMP_DIR=$TREMA_DATA_DIR/trema |
|
27 |
- |
|
28 |
-TREMA_LOG_LEVEL=${TREMA_LOG_LEVEL:-info} |
|
29 |
- |
|
30 |
-TREMA_SS_CONFIG=$TREMA_SS_ETC_DIR/sliceable.conf |
|
31 |
-TREMA_SS_APACHE_CONFIG=/etc/apache2/sites-available/sliceable_switch |
|
32 |
- |
|
33 |
-# configure_trema - Set config files, create data dirs, etc |
|
34 |
-function configure_trema() { |
|
35 |
- # prepare dir |
|
36 |
- for d in $TREMA_SS_ETC_DIR $TREMA_SS_DB_DIR $TREMA_SS_SCRIPT_DIR; do |
|
37 |
- sudo mkdir -p $d |
|
38 |
- sudo chown -R `whoami` $d |
|
39 |
- done |
|
40 |
- sudo mkdir -p $TREMA_TMP_DIR |
|
41 |
-} |
|
42 |
- |
|
43 |
-# init_trema - Initialize databases, etc. |
|
44 |
-function init_trema() { |
|
45 |
- local _pwd=$(pwd) |
|
46 |
- |
|
47 |
- # Initialize databases for Sliceable Switch |
|
48 |
- cd $TREMA_SS_DIR |
|
49 |
- rm -f filter.db slice.db |
|
50 |
- ./create_tables.sh |
|
51 |
- mv filter.db slice.db $TREMA_SS_DB_DIR |
|
52 |
- # Make sure that apache cgi has write access to the databases |
|
53 |
- sudo chown -R www-data.www-data $TREMA_SS_DB_DIR |
|
54 |
- cd $_pwd |
|
55 |
- |
|
56 |
- # Setup HTTP Server for sliceable_switch |
|
57 |
- cp $TREMA_SS_DIR/{Slice.pm,Filter.pm,config.cgi} $TREMA_SS_SCRIPT_DIR |
|
58 |
- sed -i -e "s|/home/sliceable_switch/db|$TREMA_SS_DB_DIR|" \ |
|
59 |
- $TREMA_SS_SCRIPT_DIR/config.cgi |
|
60 |
- |
|
61 |
- sudo cp $TREMA_SS_DIR/apache/sliceable_switch $TREMA_SS_APACHE_CONFIG |
|
62 |
- sudo sed -i -e "s|/home/sliceable_switch/script|$TREMA_SS_SCRIPT_DIR|" \ |
|
63 |
- $TREMA_SS_APACHE_CONFIG |
|
64 |
- sudo a2enmod rewrite actions |
|
65 |
- sudo a2ensite sliceable_switch |
|
66 |
- |
|
67 |
- cp $TREMA_SS_DIR/sliceable_switch_null.conf $TREMA_SS_CONFIG |
|
68 |
- sed -i -e "s|^\$apps_dir.*$|\$apps_dir = \"$TREMA_DIR/apps\"|" \ |
|
69 |
- -e "s|^\$db_dir.*$|\$db_dir = \"$TREMA_SS_DB_DIR\"|" \ |
|
70 |
- $TREMA_SS_CONFIG |
|
71 |
-} |
|
72 |
- |
|
73 |
-function gem_install() { |
|
74 |
- [[ "$OFFLINE" = "True" ]] && return |
|
75 |
- [ -n "$RUBYGEMS_CMD" ] || get_gem_command |
|
76 |
- |
|
77 |
- local pkg=$1 |
|
78 |
- $RUBYGEMS_CMD list | grep "^${pkg} " && return |
|
79 |
- sudo $RUBYGEMS_CMD install $pkg |
|
80 |
-} |
|
81 |
- |
|
82 |
-function get_gem_command() { |
|
83 |
- # Trema requires ruby 1.8, so gem1.8 is checked first |
|
84 |
- RUBYGEMS_CMD=$(which gem1.8 || which gem) |
|
85 |
- if [ -z "$RUBYGEMS_CMD" ]; then |
|
86 |
- echo "Warning: ruby gems command not found." |
|
87 |
- fi |
|
88 |
-} |
|
89 |
- |
|
90 |
-function install_trema() { |
|
91 |
- # Trema |
|
92 |
- gem_install trema |
|
93 |
- # Sliceable Switch |
|
94 |
- git_clone $TREMA_APPS_REPO $TREMA_DIR/apps $TREMA_APPS_BRANCH |
|
95 |
- make -C $TREMA_DIR/apps/topology |
|
96 |
- make -C $TREMA_DIR/apps/flow_manager |
|
97 |
- make -C $TREMA_DIR/apps/sliceable_switch |
|
98 |
-} |
|
99 |
- |
|
100 |
-function start_trema() { |
|
101 |
- # APACHE_NAME is defined in init_horizon (in lib/horizon) |
|
102 |
- restart_service $APACHE_NAME |
|
103 |
- |
|
104 |
- sudo LOGGING_LEVEL=$TREMA_LOG_LEVEL TREMA_TMP=$TREMA_TMP_DIR \ |
|
105 |
- trema run -d -c $TREMA_SS_CONFIG |
|
106 |
-} |
|
107 |
- |
|
108 |
-function stop_trema() { |
|
109 |
- sudo TREMA_TMP=$TREMA_TMP_DIR trema killall |
|
110 |
-} |
|
111 |
- |
|
112 |
-# Restore xtrace |
|
113 |
-$MY_XTRACE |
... | ... |
@@ -185,12 +185,12 @@ function configure_tempest() { |
185 | 185 |
fi |
186 | 186 |
|
187 | 187 |
if is_service_enabled q-l3; then |
188 |
- public_network_id=$(quantum net-list | grep $PUBLIC_NETWORK_NAME | \ |
|
188 |
+ public_network_id=$(neutron net-list | grep $PUBLIC_NETWORK_NAME | \ |
|
189 | 189 |
awk '{print $2}') |
190 | 190 |
if [ "$Q_USE_NAMESPACE" == "False" ]; then |
191 | 191 |
# If namespaces are disabled, devstack will create a single |
192 | 192 |
# public router that tempest should be configured to use. |
193 |
- public_router_id=$(quantum router-list | awk "/ $Q_ROUTER_NAME / \ |
|
193 |
+ public_router_id=$(neutron router-list | awk "/ $Q_ROUTER_NAME / \ |
|
194 | 194 |
{ print \$2 }") |
195 | 195 |
fi |
196 | 196 |
fi |
... | ... |
@@ -223,7 +223,7 @@ function configure_tempest() { |
223 | 223 |
iniset $TEMPEST_CONF compute change_password_available False |
224 | 224 |
# Note(nati) current tempest don't create network for each tenant |
225 | 225 |
# so reuse same tenant for now |
226 |
- if is_service_enabled quantum; then |
|
226 |
+ if is_service_enabled neutron; then |
|
227 | 227 |
TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-False} |
228 | 228 |
fi |
229 | 229 |
iniset $TEMPEST_CONF compute allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True} |
... | ... |
@@ -252,8 +252,8 @@ function configure_tempest() { |
252 | 252 |
iniset $TEMPEST_CONF "compute-admin" password "$password" # DEPRECATED |
253 | 253 |
|
254 | 254 |
# Network |
255 |
- if is_service_enabled quantum; then |
|
256 |
- iniset $TEMPEST_CONF network quantum_available "True" |
|
255 |
+ if is_service_enabled neutron; then |
|
256 |
+ iniset $TEMPEST_CONF network neutron_available "True" |
|
257 | 257 |
fi |
258 | 258 |
iniset $TEMPEST_CONF network api_version 2.0 |
259 | 259 |
iniset $TEMPEST_CONF network tenant_networks_reachable "$tenant_networks_reachable" |
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
|
3 | 3 |
# ``stack.sh`` is an opinionated OpenStack developer installation. It |
4 | 4 |
# installs and configures various combinations of **Ceilometer**, **Cinder**, |
5 |
-# **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Quantum** |
|
5 |
+# **Glance**, **Heat**, **Horizon**, **Keystone**, **Nova**, **Neutron** |
|
6 | 6 |
# and **Swift**. |
7 | 7 |
|
8 | 8 |
# This script allows you to specify configuration options of what git |
... | ... |
@@ -307,7 +307,7 @@ source $TOP_DIR/lib/cinder |
307 | 307 |
source $TOP_DIR/lib/swift |
308 | 308 |
source $TOP_DIR/lib/ceilometer |
309 | 309 |
source $TOP_DIR/lib/heat |
310 |
-source $TOP_DIR/lib/quantum |
|
310 |
+source $TOP_DIR/lib/neutron |
|
311 | 311 |
source $TOP_DIR/lib/baremetal |
312 | 312 |
source $TOP_DIR/lib/ldap |
313 | 313 |
|
... | ... |
@@ -583,8 +583,8 @@ if is_service_enabled $DATABASE_BACKENDS; then |
583 | 583 |
install_database |
584 | 584 |
fi |
585 | 585 |
|
586 |
-if is_service_enabled quantum; then |
|
587 |
- install_quantum_agent_packages |
|
586 |
+if is_service_enabled neutron; then |
|
587 |
+ install_neutron_agent_packages |
|
588 | 588 |
fi |
589 | 589 |
|
590 | 590 |
|
... | ... |
@@ -669,8 +669,8 @@ install_novaclient |
669 | 669 |
if is_service_enabled swift glance; then |
670 | 670 |
install_swiftclient |
671 | 671 |
fi |
672 |
-if is_service_enabled quantum nova; then |
|
673 |
- install_quantumclient |
|
672 |
+if is_service_enabled neutron nova; then |
|
673 |
+ install_neutronclient |
|
674 | 674 |
fi |
675 | 675 |
|
676 | 676 |
git_clone $OPENSTACKCLIENT_REPO $OPENSTACKCLIENT_DIR $OPENSTACKCLIENT_BRANCH |
... | ... |
@@ -705,9 +705,9 @@ if is_service_enabled cinder; then |
705 | 705 |
configure_cinder |
706 | 706 |
fi |
707 | 707 |
|
708 |
-if is_service_enabled quantum; then |
|
709 |
- install_quantum |
|
710 |
- install_quantum_third_party |
|
708 |
+if is_service_enabled neutron; then |
|
709 |
+ install_neutron |
|
710 |
+ install_neutron_third_party |
|
711 | 711 |
fi |
712 | 712 |
|
713 | 713 |
if is_service_enabled nova; then |
... | ... |
@@ -879,7 +879,7 @@ if is_service_enabled key; then |
879 | 879 |
create_keystone_accounts |
880 | 880 |
create_nova_accounts |
881 | 881 |
create_cinder_accounts |
882 |
- create_quantum_accounts |
|
882 |
+ create_neutron_accounts |
|
883 | 883 |
|
884 | 884 |
# ``keystone_data.sh`` creates services, admin and demo users, and roles. |
885 | 885 |
ADMIN_PASSWORD=$ADMIN_PASSWORD SERVICE_TENANT_NAME=$SERVICE_TENANT_NAME SERVICE_PASSWORD=$SERVICE_PASSWORD \ |
... | ... |
@@ -919,22 +919,22 @@ if is_service_enabled g-reg; then |
919 | 919 |
fi |
920 | 920 |
|
921 | 921 |
|
922 |
-# Quantum |
|
922 |
+# Neutron |
|
923 | 923 |
# ------- |
924 | 924 |
|
925 |
-if is_service_enabled quantum; then |
|
926 |
- echo_summary "Configuring Quantum" |
|
925 |
+if is_service_enabled neutron; then |
|
926 |
+ echo_summary "Configuring Neutron" |
|
927 | 927 |
|
928 |
- configure_quantum |
|
929 |
- init_quantum |
|
928 |
+ configure_neutron |
|
929 |
+ init_neutron |
|
930 | 930 |
fi |
931 | 931 |
|
932 |
-# Some Quantum plugins require network controllers which are not |
|
932 |
+# Some Neutron plugins require network controllers which are not |
|
933 | 933 |
# a part of the OpenStack project. Configure and start them. |
934 |
-if is_service_enabled quantum; then |
|
935 |
- configure_quantum_third_party |
|
936 |
- init_quantum_third_party |
|
937 |
- start_quantum_third_party |
|
934 |
+if is_service_enabled neutron; then |
|
935 |
+ configure_neutron_third_party |
|
936 |
+ init_neutron_third_party |
|
937 |
+ start_neutron_third_party |
|
938 | 938 |
fi |
939 | 939 |
|
940 | 940 |
|
... | ... |
@@ -989,8 +989,8 @@ if is_service_enabled nova; then |
989 | 989 |
init_nova |
990 | 990 |
|
991 | 991 |
# Additional Nova configuration that is dependent on other services |
992 |
- if is_service_enabled quantum; then |
|
993 |
- create_nova_conf_quantum |
|
992 |
+ if is_service_enabled neutron; then |
|
993 |
+ create_nova_conf_neutron |
|
994 | 994 |
elif is_service_enabled n-net; then |
995 | 995 |
create_nova_conf_nova_network |
996 | 996 |
fi |
... | ... |
@@ -1172,11 +1172,11 @@ if is_service_enabled n-api; then |
1172 | 1172 |
fi |
1173 | 1173 |
|
1174 | 1174 |
if is_service_enabled q-svc; then |
1175 |
- echo_summary "Starting Quantum" |
|
1175 |
+ echo_summary "Starting Neutron" |
|
1176 | 1176 |
|
1177 |
- start_quantum_service_and_check |
|
1178 |
- create_quantum_initial_network |
|
1179 |
- setup_quantum_debug |
|
1177 |
+ start_neutron_service_and_check |
|
1178 |
+ create_neutron_initial_network |
|
1179 |
+ setup_neutron_debug |
|
1180 | 1180 |
elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then |
1181 | 1181 |
NM_CONF=${NOVA_CONF} |
1182 | 1182 |
if is_service_enabled n-cell; then |
... | ... |
@@ -1193,8 +1193,8 @@ elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then |
1193 | 1193 |
$NOVA_BIN_DIR/nova-manage --config-file $NM_CONF floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL |
1194 | 1194 |
fi |
1195 | 1195 |
|
1196 |
-if is_service_enabled quantum; then |
|
1197 |
- start_quantum_agents |
|
1196 |
+if is_service_enabled neutron; then |
|
1197 |
+ start_neutron_agents |
|
1198 | 1198 |
fi |
1199 | 1199 |
if is_service_enabled nova; then |
1200 | 1200 |
echo_summary "Starting Nova" |
... | ... |
@@ -21,7 +21,7 @@ fi |
21 | 21 |
# ``disable_service`` functions in ``localrc``. |
22 | 22 |
# For example, to enable Swift add this to ``localrc``: |
23 | 23 |
# enable_service swift |
24 |
-# In order to enable Quantum (a single node setup) add the following |
|
24 |
+# In order to enable Neutron (a single node setup) add the following |
|
25 | 25 |
# settings in `` localrc``: |
26 | 26 |
# disable_service n-net |
27 | 27 |
# enable_service q-svc |
... | ... |
@@ -29,7 +29,7 @@ fi |
29 | 29 |
# enable_service q-dhcp |
30 | 30 |
# enable_service q-l3 |
31 | 31 |
# enable_service q-meta |
32 |
-# enable_service quantum |
|
32 |
+# enable_service neutron |
|
33 | 33 |
# # Optional, to enable tempest configuration as part of devstack |
34 | 34 |
# enable_service tempest |
35 | 35 |
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysql |
... | ... |
@@ -117,13 +117,13 @@ OPENSTACKCLIENT_BRANCH=${OPENSTACKCLIENT_BRANCH:-master} |
117 | 117 |
PBR_REPO=${PBR_REPO:-${GIT_BASE}/openstack-dev/pbr.git} |
118 | 118 |
PBR_BRANCH=${PBR_BRANCH:-master} |
119 | 119 |
|
120 |
-# quantum service |
|
121 |
-QUANTUM_REPO=${QUANTUM_REPO:-${GIT_BASE}/openstack/neutron.git} |
|
122 |
-QUANTUM_BRANCH=${QUANTUM_BRANCH:-master} |
|
120 |
+# neutron service |
|
121 |
+NEUTRON_REPO=${NEUTRON_REPO:-${GIT_BASE}/openstack/neutron.git} |
|
122 |
+NEUTRON_BRANCH=${NEUTRON_BRANCH:-master} |
|
123 | 123 |
|
124 |
-# quantum client |
|
125 |
-QUANTUMCLIENT_REPO=${QUANTUMCLIENT_REPO:-${GIT_BASE}/openstack/python-neutronclient.git} |
|
126 |
-QUANTUMCLIENT_BRANCH=${QUANTUMCLIENT_BRANCH:-master} |
|
124 |
+# neutron client |
|
125 |
+NEUTRONCLIENT_REPO=${NEUTRONCLIENT_REPO:-${GIT_BASE}/openstack/python-neutronclient.git} |
|
126 |
+NEUTRONCLIENT_BRANCH=${NEUTRONCLIENT_BRANCH:-master} |
|
127 | 127 |
|
128 | 128 |
# storage service |
129 | 129 |
SWIFT_REPO=${SWIFT_REPO:-${GIT_BASE}/openstack/swift.git} |
... | ... |
@@ -177,7 +177,7 @@ case "$VIRT_DRIVER" in |
177 | 177 |
fi |
178 | 178 |
;; |
179 | 179 |
xenserver) |
180 |
- # Xen config common to nova and quantum |
|
180 |
+ # Xen config common to nova and neutron |
|
181 | 181 |
XENAPI_USER=${XENAPI_USER:-"root"} |
182 | 182 |
;; |
183 | 183 |
*) |
... | ... |
@@ -39,7 +39,7 @@ The `install_os_domU.sh` script will: |
39 | 39 |
- eth0 - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME` |
40 | 40 |
- eth1 - VM interface, connected to `VM_BRIDGE_OR_NET_NAME` |
41 | 41 |
- eth2 - Public interface, connected to `PUB_BRIDGE_OR_NET_NAME` |
42 |
- - (eth3) - Optional network interface if quantum is used, to enforce xapi to |
|
42 |
+ - (eth3) - Optional network interface if neutron is used, to enforce xapi to |
|
43 | 43 |
create the underlying bridge. |
44 | 44 |
- Start devstack inside the created OpenStack VM |
45 | 45 |
|
... | ... |
@@ -58,8 +58,8 @@ install_xapi_plugins_from_zipball $NOVA_ZIPBALL_URL |
58 | 58 |
|
59 | 59 |
## Install the netwrap xapi plugin to support agent control of dom0 networking |
60 | 60 |
if [[ "$ENABLED_SERVICES" =~ "q-agt" && "$Q_PLUGIN" = "openvswitch" ]]; then |
61 |
- QUANTUM_ZIPBALL_URL=${QUANTUM_ZIPBALL_URL:-$(zip_snapshot_location $QUANTUM_REPO $QUANTUM_BRANCH)} |
|
62 |
- install_xapi_plugins_from_zipball $QUANTUM_ZIPBALL_URL |
|
61 |
+ NEUTRON_ZIPBALL_URL=${NEUTRON_ZIPBALL_URL:-$(zip_snapshot_location $NEUTRON_REPO $NEUTRON_BRANCH)} |
|
62 |
+ install_xapi_plugins_from_zipball $NEUTRON_ZIPBALL_URL |
|
63 | 63 |
fi |
64 | 64 |
|
65 | 65 |
create_directory_for_kernels |
... | ... |
@@ -72,9 +72,9 @@ setup_network "$VM_BRIDGE_OR_NET_NAME" |
72 | 72 |
setup_network "$MGT_BRIDGE_OR_NET_NAME" |
73 | 73 |
setup_network "$PUB_BRIDGE_OR_NET_NAME" |
74 | 74 |
|
75 |
-# With quantum, one more network is required, which is internal to the |
|
75 |
+# With neutron, one more network is required, which is internal to the |
|
76 | 76 |
# hypervisor, and used by the VMs |
77 |
-if is_service_enabled quantum; then |
|
77 |
+if is_service_enabled neutron; then |
|
78 | 78 |
setup_network "$XEN_INT_BRIDGE_OR_NET_NAME" |
79 | 79 |
fi |
80 | 80 |
|
... | ... |
@@ -255,9 +255,9 @@ add_interface "$GUEST_NAME" "$PUB_BRIDGE_OR_NET_NAME" "$PUB_DEV_NR" |
255 | 255 |
$THIS_DIR/build_xva.sh "$GUEST_NAME" |
256 | 256 |
|
257 | 257 |
# Attach a network interface for the integration network (so that the bridge |
258 |
-# is created by XenServer). This is required for Quantum. Also pass that as a |
|
258 |
+# is created by XenServer). This is required for Neutron. Also pass that as a |
|
259 | 259 |
# kernel parameter for DomU |
260 |
-if is_service_enabled quantum; then |
|
260 |
+if is_service_enabled neutron; then |
|
261 | 261 |
add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" $XEN_INT_DEV_NR |
262 | 262 |
|
263 | 263 |
XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME") |
... | ... |
@@ -29,7 +29,7 @@ source $TOP_DIR/lib/baremetal |
29 | 29 |
source $TOP_DIR/lib/cinder |
30 | 30 |
source $TOP_DIR/lib/horizon |
31 | 31 |
source $TOP_DIR/lib/swift |
32 |
-source $TOP_DIR/lib/quantum |
|
32 |
+source $TOP_DIR/lib/neutron |
|
33 | 33 |
|
34 | 34 |
# Determine what system we are running on. This provides ``os_VENDOR``, |
35 | 35 |
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME`` |
... | ... |
@@ -50,7 +50,7 @@ fi |
50 | 50 |
|
51 | 51 |
if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then |
52 | 52 |
source $TOP_DIR/openrc |
53 |
- teardown_quantum_debug |
|
53 |
+ teardown_neutron_debug |
|
54 | 54 |
fi |
55 | 55 |
|
56 | 56 |
# Shut down devstack's screen to get the bulk of OpenStack services in one shot |
... | ... |
@@ -106,8 +106,8 @@ if [[ -n "$UNSTACK_ALL" ]]; then |
106 | 106 |
fi |
107 | 107 |
fi |
108 | 108 |
|
109 |
-if is_service_enabled quantum; then |
|
110 |
- stop_quantum |
|
111 |
- stop_quantum_third_party |
|
112 |
- cleanup_quantum |
|
109 |
+if is_service_enabled neutron; then |
|
110 |
+ stop_neutron |
|
111 |
+ stop_neutron_third_party |
|
112 |
+ cleanup_neutron |
|
113 | 113 |
fi |