aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRadosław Piliszek <radoslaw.piliszek@gmail.com>2020-03-12 19:50:16 +0100
committerRadosław Piliszek <radoslaw.piliszek@gmail.com>2023-03-26 09:34:53 +0000
commit7367427338ee4f51624742f882d7780000238ef3 (patch)
tree82ab520ee7b6b84ce8389ddf4abbe71ce7fff5ea /tools
parent4971eccd62c6c6b0bd16d9b3b57d503a3891737d (diff)
downloadkolla-ansible-7367427338ee4f51624742f882d7780000238ef3.tar.gz
kolla-ansible-7367427338ee4f51624742f882d7780000238ef3.zip
[CI] Test Neutron with IPv6 networks
Make sure to actually test IPv6 connectivity to our test instance in the IPv6 jobs. Change-Id: I7845448804e191af356e82f8ad33c563ffd8ebd5
Diffstat (limited to 'tools')
-rwxr-xr-xtools/init-runonce46
1 files changed, 38 insertions, 8 deletions
diff --git a/tools/init-runonce b/tools/init-runonce
index f55118656..f0d0b0b5c 100755
--- a/tools/init-runonce
+++ b/tools/init-runonce
@@ -26,6 +26,12 @@ IMAGE=cirros-${CIRROS_RELEASE}-${ARCH}-disk.img
IMAGE_NAME=cirros
IMAGE_TYPE=linux
+IP_VERSION=${IP_VERSION:-4}
+
+DEMO_NET_CIDR=${DEMO_NET_CIDR:-'10.0.0.0/24'}
+DEMO_NET_GATEWAY=${DEMO_NET_GATEWAY:-'10.0.0.1'}
+DEMO_NET_DNS=${DEMO_NET_DNS:-'8.8.8.8'}
+
# This EXT_NET_CIDR is your public network,that you want to connect to the internet via.
ENABLE_EXT_NET=${ENABLE_EXT_NET:-1}
EXT_NET_CIDR=${EXT_NET_CIDR:-'10.0.2.0/24'}
@@ -90,18 +96,42 @@ echo Configuring neutron.
$KOLLA_OPENSTACK_COMMAND router create demo-router
+SUBNET_CREATE_EXTRA=""
+
+if [[ $IP_VERSION -eq 6 ]]; then
+ # NOTE(yoctozepto): Neutron defaults to "unset" (external) addressing for IPv6.
+ # The following is to use stateful DHCPv6 (RA for routing + DHCPv6 for addressing)
+ # served by Neutron Router and DHCP services.
+ # Setting this for IPv4 errors out instead of being ignored.
+ SUBNET_CREATE_EXTRA="${SUBNET_CREATE_EXTRA} --ipv6-ra-mode dhcpv6-stateful"
+ SUBNET_CREATE_EXTRA="${SUBNET_CREATE_EXTRA} --ipv6-address-mode dhcpv6-stateful"
+fi
+
$KOLLA_OPENSTACK_COMMAND network create demo-net
-$KOLLA_OPENSTACK_COMMAND subnet create --subnet-range 10.0.0.0/24 --network demo-net \
- --gateway 10.0.0.1 --dns-nameserver 8.8.8.8 demo-subnet
+$KOLLA_OPENSTACK_COMMAND subnet create --ip-version ${IP_VERSION} \
+ --subnet-range ${DEMO_NET_CIDR} --network demo-net \
+ --gateway ${DEMO_NET_GATEWAY} --dns-nameserver ${DEMO_NET_DNS} \
+ ${SUBNET_CREATE_EXTRA} demo-subnet
+
$KOLLA_OPENSTACK_COMMAND router add subnet demo-router demo-subnet
if [[ $ENABLE_EXT_NET -eq 1 ]]; then
$KOLLA_OPENSTACK_COMMAND network create --external --provider-physical-network physnet1 \
--provider-network-type flat public1
- $KOLLA_OPENSTACK_COMMAND subnet create --no-dhcp \
+ $KOLLA_OPENSTACK_COMMAND subnet create --no-dhcp --ip-version ${IP_VERSION} \
--allocation-pool ${EXT_NET_RANGE} --network public1 \
--subnet-range ${EXT_NET_CIDR} --gateway ${EXT_NET_GATEWAY} public1-subnet
- $KOLLA_OPENSTACK_COMMAND router set --external-gateway public1 demo-router
+
+ if [[ $IP_VERSION -eq 4 ]]; then
+ $KOLLA_OPENSTACK_COMMAND router set --external-gateway public1 demo-router
+ else
+ # NOTE(yoctozepto): In case of IPv6 there is no NAT support in Neutron,
+ # so we have to set up native routing. Static routes are the simplest.
+ # We need a static IP address for the router to demo.
+ $KOLLA_OPENSTACK_COMMAND router set --external-gateway public1 \
+ --fixed-ip subnet=public1-subnet,ip-address=${EXT_NET_DEMO_ROUTER_ADDR} \
+ demo-router
+ fi
fi
# Get admin user and tenant IDs
@@ -109,14 +139,14 @@ ADMIN_PROJECT_ID=$($KOLLA_OPENSTACK_COMMAND project list | awk '/ admin / {print
ADMIN_SEC_GROUP=$($KOLLA_OPENSTACK_COMMAND security group list --project ${ADMIN_PROJECT_ID} | awk '/ default / {print $2}')
# Sec Group Config
-$KOLLA_OPENSTACK_COMMAND security group rule create --ingress --ethertype IPv4 \
+$KOLLA_OPENSTACK_COMMAND security group rule create --ingress --ethertype IPv${IP_VERSION} \
--protocol icmp ${ADMIN_SEC_GROUP}
-$KOLLA_OPENSTACK_COMMAND security group rule create --ingress --ethertype IPv4 \
+$KOLLA_OPENSTACK_COMMAND security group rule create --ingress --ethertype IPv${IP_VERSION} \
--protocol tcp --dst-port 22 ${ADMIN_SEC_GROUP}
# Open heat-cfn so it can run on a different host
-$KOLLA_OPENSTACK_COMMAND security group rule create --ingress --ethertype IPv4 \
+$KOLLA_OPENSTACK_COMMAND security group rule create --ingress --ethertype IPv${IP_VERSION} \
--protocol tcp --dst-port 8000 ${ADMIN_SEC_GROUP}
-$KOLLA_OPENSTACK_COMMAND security group rule create --ingress --ethertype IPv4 \
+$KOLLA_OPENSTACK_COMMAND security group rule create --ingress --ethertype IPv${IP_VERSION} \
--protocol tcp --dst-port 8080 ${ADMIN_SEC_GROUP}
if [ ! -f ~/.ssh/id_ecdsa.pub ]; then