Skip to content

Commit c869d59

Browse files
Brian Haleybrianphaley
authored andcommitted
Add support for IPv6 tunnel endpoints
Currently, neutron tunnel endpoints must be IPv4 addresses, i.e. $HOST_IP, although IPv6 endpoints are supported by most drivers. Create a TUNNEL_IP_VERSION variable to choose which host IP to use, either HOST_IP or HOST_IPV6, and configure it in the OVS and Linuxbridge agent driver files. The default is still IPv4, but it can be over-ridden by specifying TUNNEL_ENDPOINT_IP accordingly. This behaves similar to the SERVICE_IP_VERSION option, which can either be set to 4 or 6, but not 4+6 - the tunnel overhead should be consistent on all systems in order not to have MTU issues. Must set the ML2 overlay_ip_version config option to match else agent tunnel sync RPC will not work. Must set the OVN external_ids:ovn-encap-ip config option to the correct address. Updated 'devstack-ipv6-only' job definition and verification role that will set all services and tunnels to use IPv6 addresses. Closes-bug: #1619476 Change-Id: I6034278dfc17b55d7863bc4db541bbdaa983a686
1 parent e661cae commit c869d59

10 files changed

Lines changed: 84 additions & 27 deletions

File tree

.zuul.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,11 +625,13 @@
625625
name: devstack-ipv6
626626
parent: devstack
627627
description: |
628-
Devstack single node job for integration gate with IPv6.
628+
Devstack single node job for integration gate with IPv6,
629+
all services and tunnels using IPv6 addresses.
629630
vars:
630631
devstack_localrc:
631632
SERVICE_IP_VERSION: 6
632633
SERVICE_HOST: ""
634+
TUNNEL_IP_VERSION: 6
633635

634636
- job:
635637
name: devstack-enforce-scope

doc/source/configuration.rst

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,8 @@ behavior:
521521
can be configured with any valid IPv6 prefix. The default values make
522522
use of an auto-generated ``IPV6_GLOBAL_ID`` to comply with RFC4193.
523523

524-
Service Version
525-
~~~~~~~~~~~~~~~
524+
Service IP Version
525+
~~~~~~~~~~~~~~~~~~
526526

527527
DevStack can enable service operation over either IPv4 or IPv6 by
528528
setting ``SERVICE_IP_VERSION`` to either ``SERVICE_IP_VERSION=4`` or
@@ -542,6 +542,27 @@ optionally be used to alter the default IPv6 address::
542542

543543
HOST_IPV6=${some_local_ipv6_address}
544544

545+
Tunnel IP Version
546+
~~~~~~~~~~~~~~~~~
547+
548+
DevStack can enable tunnel operation over either IPv4 or IPv6 by
549+
setting ``TUNNEL_IP_VERSION`` to either ``TUNNEL_IP_VERSION=4`` or
550+
``TUNNEL_IP_VERSION=6`` respectively.
551+
552+
When set to ``4`` Neutron will use an IPv4 address for tunnel endpoints,
553+
for example, ``HOST_IP``.
554+
555+
When set to ``6`` Neutron will use an IPv6 address for tunnel endpoints,
556+
for example, ``HOST_IPV6``.
557+
558+
The default value for this setting is ``4``. Dual-mode support, for
559+
example ``4+6`` is not supported, as this value must match the address
560+
family of the local tunnel endpoint IP(v6) address.
561+
562+
The value of ``TUNNEL_IP_VERSION`` has a direct relationship to the
563+
setting of ``TUNNEL_ENDPOINT_IP``, which will default to ``HOST_IP``
564+
when set to ``4``, and ``HOST_IPV6`` when set to ``6``.
565+
545566
Multi-node setup
546567
~~~~~~~~~~~~~~~~
547568

functions-common

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ KILL_PATH="$(which kill)"
4949
STACK_ENV_VARS="BASE_SQL_CONN DATA_DIR DEST ENABLED_SERVICES HOST_IP \
5050
KEYSTONE_SERVICE_URI \
5151
LOGFILE OS_CACERT SERVICE_HOST STACK_USER TLS_IP \
52-
HOST_IPV6 SERVICE_IP_VERSION"
52+
HOST_IPV6 SERVICE_IP_VERSION TUNNEL_ENDPOINT_IP TUNNEL_IP_VERSION"
5353

5454

5555
# Saves significant environment variables to .stackenv for later use

lib/neutron

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ function configure_neutron_new {
230230
mech_drivers+=",linuxbridge"
231231
fi
232232
iniset $NEUTRON_CORE_PLUGIN_CONF ml2 mechanism_drivers $mech_drivers
233+
iniset $NEUTRON_CORE_PLUGIN_CONF ml2 overlay_ip_version $TUNNEL_IP_VERSION
233234

234235
iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_vxlan vni_ranges 1001:2000
235236
iniset $NEUTRON_CORE_PLUGIN_CONF ml2_type_flat flat_networks $PUBLIC_NETWORK_NAME
@@ -251,10 +252,10 @@ function configure_neutron_new {
251252
# Configure the neutron agent
252253
if [[ $NEUTRON_AGENT == "linuxbridge" ]]; then
253254
iniset $NEUTRON_CORE_PLUGIN_CONF securitygroup firewall_driver iptables
254-
iniset $NEUTRON_CORE_PLUGIN_CONF vxlan local_ip $HOST_IP
255+
iniset $NEUTRON_CORE_PLUGIN_CONF vxlan local_ip $TUNNEL_ENDPOINT_IP
255256
elif [[ $NEUTRON_AGENT == "openvswitch" ]]; then
256257
iniset $NEUTRON_CORE_PLUGIN_CONF securitygroup firewall_driver openvswitch
257-
iniset $NEUTRON_CORE_PLUGIN_CONF ovs local_ip $HOST_IP
258+
iniset $NEUTRON_CORE_PLUGIN_CONF ovs local_ip $TUNNEL_ENDPOINT_IP
258259

259260
if [[ "$NEUTRON_DISTRIBUTED_ROUTING" = "True" ]]; then
260261
iniset $NEUTRON_CORE_PLUGIN_CONF agent l2_population True

lib/neutron-legacy

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,6 @@ if [[ $Q_AGENT == "linuxbridge" && -z ${LB_PHYSICAL_INTERFACE} ]]; then
246246
LB_PHYSICAL_INTERFACE=$default_route_dev
247247
fi
248248

249-
# When Neutron tunnels are enabled it is needed to specify the
250-
# IP address of the end point in the local server. This IP is set
251-
# by default to the same IP address that the HOST IP.
252-
# This variable can be used to specify a different end point IP address
253-
# Example: ``TUNNEL_ENDPOINT_IP=1.1.1.1``
254-
TUNNEL_ENDPOINT_IP=${TUNNEL_ENDPOINT_IP:-$HOST_IP}
255-
256249
# With the openvswitch plugin, set to True in ``localrc`` to enable
257250
# provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False.
258251
#

lib/neutron_plugins/ml2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ function neutron_plugin_configure_service {
125125
fi
126126

127127
populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2 mechanism_drivers=$Q_ML2_PLUGIN_MECHANISM_DRIVERS
128+
populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2 overlay_ip_version=$TUNNEL_IP_VERSION
128129

129130
if [[ -n "$Q_ML2_PLUGIN_TYPE_DRIVERS" ]]; then
130131
populate_ml2_config /$Q_PLUGIN_CONF_FILE ml2 type_drivers=$Q_ML2_PLUGIN_TYPE_DRIVERS

lib/neutron_plugins/ovn_agent

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ ENABLE_CHASSIS_AS_GW=$(trueorfalse True ENABLE_CHASSIS_AS_GW)
9999
OVN_L3_CREATE_PUBLIC_NETWORK=$(trueorfalse True OVN_L3_CREATE_PUBLIC_NETWORK)
100100

101101
export OVSDB_SERVER_LOCAL_HOST=$SERVICE_LOCAL_HOST
102+
TUNNEL_IP=$TUNNEL_ENDPOINT_IP
102103
if [[ "$SERVICE_IP_VERSION" == 6 ]]; then
103104
OVSDB_SERVER_LOCAL_HOST=[$OVSDB_SERVER_LOCAL_HOST]
105+
TUNNEL_IP=[$TUNNEL_IP]
104106
fi
105107

106108
OVN_IGMP_SNOOPING_ENABLE=$(trueorfalse False OVN_IGMP_SNOOPING_ENABLE)
@@ -639,7 +641,7 @@ function _start_ovs {
639641
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-remote="$OVN_SB_REMOTE"
640642
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-bridge="br-int"
641643
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-type="geneve"
642-
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-ip="$HOST_IP"
644+
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:ovn-encap-ip="$TUNNEL_IP"
643645
sudo ovs-vsctl --no-wait set open_vswitch . external-ids:hostname="$LOCAL_HOSTNAME"
644646
# Select this chassis to host gateway routers
645647
if [[ "$ENABLE_CHASSIS_AS_GW" == "True" ]]; then
@@ -654,7 +656,7 @@ function _start_ovs {
654656
if is_service_enabled ovn-controller-vtep ; then
655657
ovn_base_setup_bridge br-v
656658
vtep-ctl add-ps br-v
657-
vtep-ctl set Physical_Switch br-v tunnel_ips=$HOST_IP
659+
vtep-ctl set Physical_Switch br-v tunnel_ips=$TUNNEL_IP
658660

659661
enable_service ovs-vtep
660662
local vtepcmd="$OVS_SCRIPTDIR/ovs-vtep --log-file --pidfile --detach br-v"

roles/devstack-ipv6-only-deployments-verification/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
Verify the IPv6-only deployments
1+
Verify all addresses in IPv6-only deployments
22

33
This role needs to be invoked from a playbook that
4-
run tests. This role verifies the IPv6 setting on
5-
devstack side and devstack deploy services on IPv6.
6-
This role is invoked before tests are run so that
7-
if any missing IPv6 setting or deployments can fail
4+
runs tests. This role verifies the IPv6 settings on the
5+
devstack side and that devstack deploys with all addresses
6+
being IPv6. This role is invoked before tests are run so that
7+
if there is any missing IPv6 setting, deployments can fail
88
the job early.
99

1010

stackrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,32 @@ SERVICE_HOST=${SERVICE_HOST:-${DEF_SERVICE_HOST}}
877877
# This is either 127.0.0.1 for IPv4 or ::1 for IPv6
878878
SERVICE_LOCAL_HOST=${SERVICE_LOCAL_HOST:-${DEF_SERVICE_LOCAL_HOST}}
879879

880+
# TUNNEL IP version
881+
# This is the IP version to use for tunnel endpoints
882+
TUNNEL_IP_VERSION=${TUNNEL_IP_VERSION:-4}
883+
884+
# Validate TUNNEL_IP_VERSION
885+
if [[ $TUNNEL_IP_VERSION != "4" ]] && [[ $TUNNEL_IP_VERSION != "6" ]]; then
886+
die $LINENO "TUNNEL_IP_VERSION must be either 4 or 6"
887+
fi
888+
889+
if [[ "$TUNNEL_IP_VERSION" == 4 ]]; then
890+
DEF_TUNNEL_ENDPOINT_IP=$HOST_IP
891+
fi
892+
893+
if [[ "$TUNNEL_IP_VERSION" == 6 ]]; then
894+
# Only die if the user has not over-ridden the endpoint IP
895+
if [[ "$HOST_IPV6" == "" ]] && [[ "$TUNNEL_ENDPOINT_IP" == "" ]]; then
896+
die $LINENO "Could not determine host IPv6 address. See local.conf for suggestions on setting HOST_IPV6."
897+
fi
898+
899+
DEF_TUNNEL_ENDPOINT_IP=$HOST_IPV6
900+
fi
901+
902+
# Allow the use of an alternate address for tunnel endpoints.
903+
# Default is dependent on TUNNEL_IP_VERSION above.
904+
TUNNEL_ENDPOINT_IP=${TUNNEL_ENDPOINT_IP:-${DEF_TUNNEL_ENDPOINT_IP}}
905+
880906
REGION_NAME=${REGION_NAME:-RegionOne}
881907

882908
# Configure services to use syslog instead of writing to individual log files

tools/verify-ipv6-only-deployments.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,43 @@ function verify_devstack_ipv6_setting {
2323
_service_listen_address=$(echo $SERVICE_LISTEN_ADDRESS | tr -d [])
2424
local _service_local_host=''
2525
_service_local_host=$(echo $SERVICE_LOCAL_HOST | tr -d [])
26+
local _tunnel_endpoint_ip=''
27+
_tunnel_endpoint_ip=$(echo $TUNNEL_ENDPOINT_IP | tr -d [])
2628
if [[ "$SERVICE_IP_VERSION" != 6 ]]; then
2729
echo $SERVICE_IP_VERSION "SERVICE_IP_VERSION is not set to 6 which is must for devstack to deploy services with IPv6 address."
2830
exit 1
2931
fi
32+
if [[ "$TUNNEL_IP_VERSION" != 6 ]]; then
33+
echo $TUNNEL_IP_VERSION "TUNNEL_IP_VERSION is not set to 6 so TUNNEL_ENDPOINT_IP cannot be an IPv6 address."
34+
exit 1
35+
fi
3036
is_service_host_ipv6=$(python3 -c 'import oslo_utils.netutils as nutils; print(nutils.is_valid_ipv6("'$_service_host'"))')
3137
if [[ "$is_service_host_ipv6" != "True" ]]; then
32-
echo $SERVICE_HOST "SERVICE_HOST is not ipv6 which means devstack cannot deploy services on IPv6 address."
38+
echo $SERVICE_HOST "SERVICE_HOST is not IPv6 which means devstack cannot deploy services on IPv6 addresses."
3339
exit 1
3440
fi
3541
is_host_ipv6=$(python3 -c 'import oslo_utils.netutils as nutils; print(nutils.is_valid_ipv6("'$_host_ipv6'"))')
3642
if [[ "$is_host_ipv6" != "True" ]]; then
37-
echo $HOST_IPV6 "HOST_IPV6 is not ipv6 which means devstack cannot deploy services on IPv6 address."
43+
echo $HOST_IPV6 "HOST_IPV6 is not IPv6 which means devstack cannot deploy services on IPv6 addresses."
3844
exit 1
3945
fi
4046
is_service_listen_address=$(python3 -c 'import oslo_utils.netutils as nutils; print(nutils.is_valid_ipv6("'$_service_listen_address'"))')
4147
if [[ "$is_service_listen_address" != "True" ]]; then
42-
echo $SERVICE_LISTEN_ADDRESS "SERVICE_LISTEN_ADDRESS is not ipv6 which means devstack cannot deploy services on IPv6 address."
48+
echo $SERVICE_LISTEN_ADDRESS "SERVICE_LISTEN_ADDRESS is not IPv6 which means devstack cannot deploy services on IPv6 addresses."
4349
exit 1
4450
fi
4551
is_service_local_host=$(python3 -c 'import oslo_utils.netutils as nutils; print(nutils.is_valid_ipv6("'$_service_local_host'"))')
4652
if [[ "$is_service_local_host" != "True" ]]; then
47-
echo $SERVICE_LOCAL_HOST "SERVICE_LOCAL_HOST is not ipv6 which means devstack cannot deploy services on IPv6 address."
53+
echo $SERVICE_LOCAL_HOST "SERVICE_LOCAL_HOST is not IPv6 which means devstack cannot deploy services on IPv6 addresses."
54+
exit 1
55+
fi
56+
is_tunnel_endpoint_ip=$(python3 -c 'import oslo_utils.netutils as nutils; print(nutils.is_valid_ipv6("'$_tunnel_endpoint_ip'"))')
57+
if [[ "$is_tunnel_endpoint_ip" != "True" ]]; then
58+
echo $TUNNEL_ENDPOINT_IP "TUNNEL_ENDPOINT_IP is not IPv6 which means devstack will not deploy with an IPv6 endpoint address."
4859
exit 1
4960
fi
5061
echo "Devstack is properly configured with IPv6"
51-
echo "SERVICE_IP_VERSION: " $SERVICE_IP_VERSION "HOST_IPV6: " $HOST_IPV6 "SERVICE_HOST: " $SERVICE_HOST "SERVICE_LISTEN_ADDRESS: " $SERVICE_LISTEN_ADDRESS "SERVICE_LOCAL_HOST: " $SERVICE_LOCAL_HOST
62+
echo "SERVICE_IP_VERSION:" $SERVICE_IP_VERSION "HOST_IPV6:" $HOST_IPV6 "SERVICE_HOST:" $SERVICE_HOST "SERVICE_LISTEN_ADDRESS:" $SERVICE_LISTEN_ADDRESS "SERVICE_LOCAL_HOST:" $SERVICE_LOCAL_HOST "TUNNEL_IP_VERSION:" $TUNNEL_IP_VERSION "TUNNEL_ENDPOINT_IP:" $TUNNEL_ENDPOINT_IP
5263
}
5364

5465
function sanity_check_system_ipv6_enabled {
@@ -72,15 +83,15 @@ function verify_service_listen_address_is_ipv6 {
7283
is_endpoint_ipv6=$(python3 -c 'import oslo_utils.netutils as nutils; print(nutils.is_valid_ipv6("'$endpoint_address'"))')
7384
if [[ "$is_endpoint_ipv6" != "True" ]]; then
7485
all_ipv6=False
75-
echo $endpoint ": This is not ipv6 endpoint which means corresponding service is not listening on IPv6 address."
86+
echo $endpoint ": This is not an IPv6 endpoint which means corresponding service is not listening on an IPv6 address."
7687
continue
7788
fi
7889
endpoints_verified=True
7990
done
8091
if [[ "$all_ipv6" == "False" ]] || [[ "$endpoints_verified" == "False" ]]; then
8192
exit 1
8293
fi
83-
echo "All services deployed by devstack is on IPv6 endpoints"
94+
echo "All services deployed by devstack are on IPv6 endpoints"
8495
echo $endpoints
8596
}
8697

0 commit comments

Comments
 (0)