/usr/share/tripleo-image-elements/neutron-openvswitch-agent/bin/init-neutron-ovs is in python-tripleo-image-elements 0.7.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #!/bin/bash
# Idempotent script to apply heat configuration to the running network
# environment.
#
# If a public_interface_raw_device is defined in metadata and public_interface
# does not exist, the public_interface is used to derived a vlan id and a vlan
# interface is configured.
#
# If a bootstrap public_interface_ip is defined in metadata and not attached to
# any device then it will be added to the public_interface device if one is
# defined.
#
# An integration bridge for neutron-ovs-agent is created.
#
# If no physical bridge is defined in metadata, the script will have no
# further effect.
#
# If a physical bridge is defined then ensure-bridge is called to set it up.
#
# Note that no persistent config file is written to the OS : ovs-vsctl modifies
# a persistent database so the bridge device will persist across reboots, but
# [on Ubuntu at least] early boot does not bring up ovs-vswitch early enough,
# and metadata access will fail.
set -eux
PATH=/usr/local/bin:$PATH
EXTERNAL_BRIDGE=$(os-apply-config --key neutron.ovs.physical_bridge --type raw --key-default '')
PHYSICAL_INTERFACE=$(os-apply-config --key neutron.ovs.public_interface --type raw --key-default '')
PHYSICAL_INTERFACE_IP=$(os-apply-config --key bootstack.public_interface_ip --type netaddress --key-default '')
PHYSICAL_INTERFACE_RAW_DEVICE=$(os-apply-config --key neutron.ovs.public_interface_raw_device --type raw --key-default '')
PUBLIC_INTERFACE_ROUTE=$(os-apply-config --key neutron.ovs.public_interface_route --type netaddress --key-default '')
if [ -n "$PHYSICAL_INTERFACE_RAW_DEVICE" ]; then
if ! (ip link show dev $PHYSICAL_INTERFACE) ; then
VLAN_ID=$(echo $PHYSICAL_INTERFACE | sed s/vlan//)
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
vconfig add $PHYSICAL_INTERFACE_RAW_DEVICE $VLAN_ID
fi
ip link set $PHYSICAL_INTERFACE up
fi
if [ -n "$PHYSICAL_INTERFACE_IP" -a -n "$PHYSICAL_INTERFACE" ] ; then
if ! (ip addr show | grep -q $PHYSICAL_INTERFACE_IP) ; then
ip addr add $PHYSICAL_INTERFACE_IP dev $PHYSICAL_INTERFACE
fi
fi
# Hacky: ensure the switch is running : we should instead arrange for this
# script to not be run before it's started.
service openvswitch-switch restart || service openvswitch restart
ovs-vsctl --no-wait -- --may-exist add-br br-int
ovs-vsctl --no-wait br-set-external-id br-int bridge-id br-int
if [ -z "$EXTERNAL_BRIDGE" ] ; then
exit 0
fi
ensure-bridge "$EXTERNAL_BRIDGE" "$PHYSICAL_INTERFACE" "$PUBLIC_INTERFACE_ROUTE"
|